H, W, M = map(int, input().split())

Hc = [0 for i in range(H)]
Wc = [0 for i in range(W)]
B = []

for m in range(M):
  h, w = map(int, input().split())
  Hc[h - 1] += 1
  Wc[w - 1] += 1
  B.append((h - 1, w - 1))
Hcmax = max(Hc)
Hcmax_idx = [i for i, x in enumerate(Hc) if x == Hcmax] 
Wcmax = max(Wc)
Wcmax_idx = [i for i, x in enumerate(Wc) if x == Wcmax] 

ans = Hcmax + Wcmax - 1
B = set(B)
f = False
for i in Hcmax_idx:
  if f:
    break
  for j in Wcmax_idx:
    if (i, j) not in B:
      ans = Hcmax + Wcmax
      f = True
      break
print(ans) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M 0 for i in range(H) for i in range(H) i range(H) range H for i in range(H) 0 Hc = [0 for i in range(H)] Hc [0 for i in range(H)] 0 for i in range(W) for i in range(W) i range(W) range W for i in range(W) 0 Wc = [0 for i in range(W)] Wc [0 for i in range(W)] B = [] B [] for m in range(M):
  h, w = map(int, input().split())
  Hc[h - 1] += 1
  Wc[w - 1] += 1
  B.append((h - 1, w - 1)) m range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w Hc[h - 1] += 1 Hc[h - 1] Hc h - 1 h 1 1 Wc[w - 1] += 1 Wc[w - 1] Wc w - 1 w 1 1 B.append((h - 1, w - 1)) B.append B append (h - 1, w - 1) h - 1 h 1 w - 1 w 1 Hcmax = max(Hc) Hcmax max(Hc) max Hc i for i, x in enumerate(Hc) if x == Hcmax for i, x in enumerate(Hc) if x == Hcmax i x enumerate(Hc) enumerate Hc x == Hcmax x Hcmax if x == Hcmax i Hcmax_idx = [i for i, x in enumerate(Hc) if x == Hcmax] Hcmax_idx [i for i, x in enumerate(Hc) if x == Hcmax] Wcmax = max(Wc) Wcmax max(Wc) max Wc i for i, x in enumerate(Wc) if x == Wcmax for i, x in enumerate(Wc) if x == Wcmax i x enumerate(Wc) enumerate Wc x == Wcmax x Wcmax if x == Wcmax i Wcmax_idx = [i for i, x in enumerate(Wc) if x == Wcmax] Wcmax_idx [i for i, x in enumerate(Wc) if x == Wcmax] ans = Hcmax + Wcmax - 1 ans Hcmax + Wcmax - 1 Hcmax + Wcmax Hcmax Wcmax 1 B = set(B) B set(B) set B f = False f False for i in Hcmax_idx:
  if f:
    break
  for j in Wcmax_idx:
    if (i, j) not in B:
      ans = Hcmax + Wcmax
      f = True
      break i Hcmax_idx if f:
    break
   f break for j in Wcmax_idx:
    if (i, j) not in B:
      ans = Hcmax + Wcmax
      f = True
      break j Wcmax_idx if (i, j) not in B:
      ans = Hcmax + Wcmax
      f = True
      break (i, j) not in B (i, j) i j B ans = Hcmax + Wcmax ans Hcmax + Wcmax Hcmax Wcmax f = True f True break print(ans) print ans Wcmax = max(Wc) max(Wc) Wcmax w = map(int, input().split()) map(int, input().split()) w Hcmax = max(Hc) max(Hc) Hcmax B = set(B) set(B) B H, W, M = map(int, input().split()) map(int, input().split()) H f = False False f ans = Hcmax + Wcmax Hcmax + Wcmax ans Hc = [0 for i in range(H)] [0 for i in range(H)] Hc B = [] [] B h, w = map(int, input().split()) map(int, input().split()) h Hcmax_idx = [i for i, x in enumerate(Hc) if x == Hcmax] [i for i, x in enumerate(Hc) if x == Hcmax] Hcmax_idx W, M = map(int, input().split()) map(int, input().split()) W Wcmax_idx = [i for i, x in enumerate(Wc) if x == Wcmax] [i for i, x in enumerate(Wc) if x == Wcmax] Wcmax_idx M = map(int, input().split()) map(int, input().split()) M f = True True f Wc = [0 for i in range(W)] [0 for i in range(W)] Wc ans = Hcmax + Wcmax - 1 Hcmax + Wcmax - 1 ans
H, W, M = map(int, input().split())

Hc = [0 for i in range(H)]
Wc = [0 for i in range(W)]
B = []

for m in range(M):
  h, w = map(int, input().split())
  Hc[h - 1] += 1
  Wc[w - 1] += 1
  B.append((h - 1, w - 1))
Hcmax = max(Hc)
Hcmax_idx = [i for i, x in enumerate(Hc) if x == Hcmax] 
Wcmax = max(Wc)
Wcmax_idx = [i for i, x in enumerate(Wc) if x == Wcmax] 

ans = Hcmax + Wcmax - 1
B = set(B)
f = False
for i in Hcmax_idx:
  if f:
    break
  for j in Wcmax_idx:
    if (i, j) not in B:
      ans = Hcmax + Wcmax
      f = True
      break
print(ans)