h,w,m=map(int,input().split())
bomb=[list(map(int,input().split())) for i in range(m)]

num_h = [0] * (h+1)
num_w = [0] * (w+1)
bomb_set = set()
for hi,wi in bomb:
  num_h[hi] += 1
  num_w[wi] += 1
  bomb_set.add((hi,wi))
  
max_h = max(num_h)
max_w = max(num_w)
max_hs = [k for k,v in enumerate(num_h) if v == max_h]
max_ws = [k for k,v in enumerate(num_w) if v == max_w]

result = max_h + max_w
for i in max_hs:
  for j in max_ws:
    if (i,j) not in bomb_set:
      print(result)
      exit(0)
print(result-1) h,w,m=map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m list(map(int,input().split())) for i in range(m) for i in range(m) i range(m) range m for i in range(m) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split bomb=[list(map(int,input().split())) for i in range(m)] bomb [list(map(int,input().split())) for i in range(m)] num_h = [0] * (h+1) num_h [0] * (h+1) [0] 0 h+1 h 1 num_w = [0] * (w+1) num_w [0] * (w+1) [0] 0 w+1 w 1 bomb_set = set() bomb_set set() set for hi,wi in bomb:
  num_h[hi] += 1
  num_w[wi] += 1
  bomb_set.add((hi,wi))
   hi wi bomb num_h[hi] += 1 num_h[hi] num_h hi 1 num_w[wi] += 1 num_w[wi] num_w wi 1 bomb_set.add((hi,wi)) bomb_set.add bomb_set add (hi,wi) hi wi max_h = max(num_h) max_h max(num_h) max num_h max_w = max(num_w) max_w max(num_w) max num_w k for k,v in enumerate(num_h) if v == max_h for k,v in enumerate(num_h) if v == max_h k v enumerate(num_h) enumerate num_h v == max_h v max_h if v == max_h k max_hs = [k for k,v in enumerate(num_h) if v == max_h] max_hs [k for k,v in enumerate(num_h) if v == max_h] k for k,v in enumerate(num_w) if v == max_w for k,v in enumerate(num_w) if v == max_w k v enumerate(num_w) enumerate num_w v == max_w v max_w if v == max_w k max_ws = [k for k,v in enumerate(num_w) if v == max_w] max_ws [k for k,v in enumerate(num_w) if v == max_w] result = max_h + max_w result max_h + max_w max_h max_w for i in max_hs:
  for j in max_ws:
    if (i,j) not in bomb_set:
      print(result)
      exit(0) i max_hs for j in max_ws:
    if (i,j) not in bomb_set:
      print(result)
      exit(0) j max_ws if (i,j) not in bomb_set:
      print(result)
      exit(0) (i,j) not in bomb_set (i,j) i j bomb_set print(result) print result exit(0) exit 0 print(result-1) print result-1 result 1 num_w = [0] * (w+1) [0] * (w+1) num_w m=map(int,input().split()) map(int,input().split()) m bomb=[list(map(int,input().split())) for i in range(m)] [list(map(int,input().split())) for i in range(m)] bomb max_ws = [k for k,v in enumerate(num_w) if v == max_w] [k for k,v in enumerate(num_w) if v == max_w] max_ws h,w,m=map(int,input().split()) map(int,input().split()) h max_h = max(num_h) max(num_h) max_h w,m=map(int,input().split()) map(int,input().split()) w max_w = max(num_w) max(num_w) max_w num_h = [0] * (h+1) [0] * (h+1) num_h bomb_set = set() set() bomb_set result = max_h + max_w max_h + max_w result max_hs = [k for k,v in enumerate(num_h) if v == max_h] [k for k,v in enumerate(num_h) if v == max_h] max_hs
h,w,m=map(int,input().split())
bomb=[list(map(int,input().split())) for i in range(m)]

num_h = [0] * (h+1)
num_w = [0] * (w+1)
bomb_set = set()
for hi,wi in bomb:
  num_h[hi] += 1
  num_w[wi] += 1
  bomb_set.add((hi,wi))
  
max_h = max(num_h)
max_w = max(num_w)
max_hs = [k for k,v in enumerate(num_h) if v == max_h]
max_ws = [k for k,v in enumerate(num_w) if v == max_w]

result = max_h + max_w
for i in max_hs:
  for j in max_ws:
    if (i,j) not in bomb_set:
      print(result)
      exit(0)
print(result-1)
