#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy
from collections import defaultdict

def main():
  h, w, m = map(int, input().strip().split())
  fieldh = numpy.zeros(h, dtype=numpy.int)
  fieldw = numpy.zeros(w, dtype=numpy.int)
  field = defaultdict(int)
  for _ in range(m):
    ih, iw = map(int, input().strip().split())
    fieldh[ih-1] += 1
    fieldw[iw-1] += 1
    field[ih-1, iw-1] = 1
    
  max_h = numpy.max(fieldh)
  max_w = numpy.max(fieldw)
  argsort_h = [ ih for ih in range(h) if fieldh[ih] == max_h ]
  argsort_w = [ iw for iw in range(w) if fieldw[iw] == max_w ]
  
  max_cnt = 0
  for ih in argsort_h:
    for iw in argsort_w:
      if field[ih, iw] == 0:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw])
        print(max_cnt)
        return 
      else:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]-1)
  print(max_cnt)

if __name__=='__main__':
  main()
 import numpy numpy from collections import defaultdict def main():
  h, w, m = map(int, input().strip().split())
  fieldh = numpy.zeros(h, dtype=numpy.int)
  fieldw = numpy.zeros(w, dtype=numpy.int)
  field = defaultdict(int)
  for _ in range(m):
    ih, iw = map(int, input().strip().split())
    fieldh[ih-1] += 1
    fieldw[iw-1] += 1
    field[ih-1, iw-1] = 1
    
  max_h = numpy.max(fieldh)
  max_w = numpy.max(fieldw)
  argsort_h = [ ih for ih in range(h) if fieldh[ih] == max_h ]
  argsort_w = [ iw for iw in range(w) if fieldw[iw] == max_w ]
  
  max_cnt = 0
  for ih in argsort_h:
    for iw in argsort_w:
      if field[ih, iw] == 0:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw])
        print(max_cnt)
        return 
      else:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]-1)
  print(max_cnt) main h, w, m = map(int, input().strip().split()) h map(int, input().strip().split()) map int input().strip().split() ().strip().split ().strip() ().strip () input strip split w m fieldh = numpy.zeros(h, dtype=numpy.int) fieldh numpy.zeros(h, dtype=numpy.int) numpy.zeros numpy zeros h dtype=numpy.int dtype numpy.int numpy int fieldw = numpy.zeros(w, dtype=numpy.int) fieldw numpy.zeros(w, dtype=numpy.int) numpy.zeros numpy zeros w dtype=numpy.int dtype numpy.int numpy int field = defaultdict(int) field defaultdict(int) defaultdict int for _ in range(m):
    ih, iw = map(int, input().strip().split())
    fieldh[ih-1] += 1
    fieldw[iw-1] += 1
    field[ih-1, iw-1] = 1
    
   _ range(m) range m ih, iw = map(int, input().strip().split()) ih map(int, input().strip().split()) map int input().strip().split() ().strip().split ().strip() ().strip () input strip split iw fieldh[ih-1] += 1 fieldh[ih-1] fieldh ih-1 ih 1 1 fieldw[iw-1] += 1 fieldw[iw-1] fieldw iw-1 iw 1 1 field[ih-1, iw-1] = 1 field[ih-1, iw-1] field ih-1 ih 1 1 max_h = numpy.max(fieldh) max_h numpy.max(fieldh) numpy.max numpy max fieldh max_w = numpy.max(fieldw) max_w numpy.max(fieldw) numpy.max numpy max fieldw ih for ih in range(h) if fieldh[ih] == max_h for ih in range(h) if fieldh[ih] == max_h ih range(h) range h fieldh[ih] == max_h fieldh[ih] fieldh ih max_h if fieldh[ih] == max_h ih argsort_h = [ ih for ih in range(h) if fieldh[ih] == max_h ] argsort_h [ ih for ih in range(h) if fieldh[ih] == max_h ] iw for iw in range(w) if fieldw[iw] == max_w for iw in range(w) if fieldw[iw] == max_w iw range(w) range w fieldw[iw] == max_w fieldw[iw] fieldw iw max_w if fieldw[iw] == max_w iw argsort_w = [ iw for iw in range(w) if fieldw[iw] == max_w ] argsort_w [ iw for iw in range(w) if fieldw[iw] == max_w ] max_cnt = 0 max_cnt 0 for ih in argsort_h:
    for iw in argsort_w:
      if field[ih, iw] == 0:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw])
        print(max_cnt)
        return 
      else:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]-1)
   ih argsort_h for iw in argsort_w:
      if field[ih, iw] == 0:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw])
        print(max_cnt)
        return 
      else:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]-1)
   iw argsort_w if field[ih, iw] == 0:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw])
        print(max_cnt)
        return 
      else:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]-1)
   field[ih, iw] == 0 field[ih, iw] field ih 0 max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]) max_cnt max(max_cnt, fieldh[ih]+fieldw[iw]) max max_cnt fieldh[ih]+fieldw[iw] fieldh[ih] fieldh ih fieldw[iw] fieldw iw print(max_cnt) print max_cnt return max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]-1) max_cnt max(max_cnt, fieldh[ih]+fieldw[iw]-1) max max_cnt fieldh[ih]+fieldw[iw]-1 fieldh[ih]+fieldw[iw] fieldh[ih] fieldh ih fieldw[iw] fieldw iw 1 print(max_cnt) print max_cnt if __name__=='__main__':
  main() __name__=='__main__' __name__ '__main__' main() main def main():
  h, w, m = map(int, input().strip().split())
  fieldh = numpy.zeros(h, dtype=numpy.int)
  fieldw = numpy.zeros(w, dtype=numpy.int)
  field = defaultdict(int)
  for _ in range(m):
    ih, iw = map(int, input().strip().split())
    fieldh[ih-1] += 1
    fieldw[iw-1] += 1
    field[ih-1, iw-1] = 1
    
  max_h = numpy.max(fieldh)
  max_w = numpy.max(fieldw)
  argsort_h = [ ih for ih in range(h) if fieldh[ih] == max_h ]
  argsort_w = [ iw for iw in range(w) if fieldw[iw] == max_w ]
  
  max_cnt = 0
  for ih in argsort_h:
    for iw in argsort_w:
      if field[ih, iw] == 0:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw])
        print(max_cnt)
        return 
      else:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]-1)
  print(max_cnt) def main():
  h, w, m = map(int, input().strip().split())
  fieldh = numpy.zeros(h, dtype=numpy.int)
  fieldw = numpy.zeros(w, dtype=numpy.int)
  field = defaultdict(int)
  for _ in range(m):
    ih, iw = map(int, input().strip().split())
    fieldh[ih-1] += 1
    fieldw[iw-1] += 1
    field[ih-1, iw-1] = 1
    
  max_h = numpy.max(fieldh)
  max_w = numpy.max(fieldw)
  argsort_h = [ ih for ih in range(h) if fieldh[ih] == max_h ]
  argsort_w = [ iw for iw in range(w) if fieldw[iw] == max_w ]
  
  max_cnt = 0
  for ih in argsort_h:
    for iw in argsort_w:
      if field[ih, iw] == 0:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw])
        print(max_cnt)
        return 
      else:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]-1)
  print(max_cnt) main
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy
from collections import defaultdict

def main():
  h, w, m = map(int, input().strip().split())
  fieldh = numpy.zeros(h, dtype=numpy.int)
  fieldw = numpy.zeros(w, dtype=numpy.int)
  field = defaultdict(int)
  for _ in range(m):
    ih, iw = map(int, input().strip().split())
    fieldh[ih-1] += 1
    fieldw[iw-1] += 1
    field[ih-1, iw-1] = 1
    
  max_h = numpy.max(fieldh)
  max_w = numpy.max(fieldw)
  argsort_h = [ ih for ih in range(h) if fieldh[ih] == max_h ]
  argsort_w = [ iw for iw in range(w) if fieldw[iw] == max_w ]
  
  max_cnt = 0
  for ih in argsort_h:
    for iw in argsort_w:
      if field[ih, iw] == 0:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw])
        print(max_cnt)
        return 
      else:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]-1)
  print(max_cnt)

if __name__=='__main__':
  main()

