H, W, M = map(int, input().split())
 
h = [0] * H
w = [0] * W
Mem = [tuple(map(int, input().split())) for _ in range(M) ]
for i, j in Mem:
  h[i-1] += 1
  w[j-1] += 1

maxh = max(h)
maxw = max(w)
 
listh = {i for i, v in enumerate(h, 1) if v == maxh}
listw = {j for j, v in enumerate(w, 1) if v == maxw}

cnt = len(listh) * len(listw)

for i, j in Mem:
  if i in listh and j in listw:
    cnt -= 1
 
if cnt:
  ans = maxh + maxw
else:
  ans = maxh + maxw - 1

print(ans) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M h = [0] * H h [0] * H [0] 0 H w = [0] * W w [0] * W [0] 0 W tuple(map(int, input().split())) for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split Mem = [tuple(map(int, input().split())) for _ in range(M) ] Mem [tuple(map(int, input().split())) for _ in range(M) ] for i, j in Mem:
  h[i-1] += 1
  w[j-1] += 1 i j Mem h[i-1] += 1 h[i-1] h i-1 i 1 1 w[j-1] += 1 w[j-1] w j-1 j 1 1 maxh = max(h) maxh max(h) max h maxw = max(w) maxw max(w) max w i for i, v in enumerate(h, 1) if v == maxh for i, v in enumerate(h, 1) if v == maxh i v enumerate(h, 1) enumerate h 1 v == maxh v maxh if v == maxh i listh = {i for i, v in enumerate(h, 1) if v == maxh} listh j for j, v in enumerate(w, 1) if v == maxw for j, v in enumerate(w, 1) if v == maxw j v enumerate(w, 1) enumerate w 1 v == maxw v maxw if v == maxw j listw = {j for j, v in enumerate(w, 1) if v == maxw} listw cnt = len(listh) * len(listw) cnt len(listh) * len(listw) len(listh) len listh len(listw) len listw for i, j in Mem:
  if i in listh and j in listw:
    cnt -= 1
  i j Mem if i in listh and j in listw:
    cnt -= 1
  i in listh and j in listw i in listh i listh j in listw j listw cnt -= 1 cnt 1 if cnt:
  ans = maxh + maxw
else:
  ans = maxh + maxw - 1 cnt ans = maxh + maxw ans maxh + maxw maxh maxw ans = maxh + maxw - 1 ans maxh + maxw - 1 maxh + maxw maxh maxw 1 print(ans) print ans cnt -= 1 1 cnt listw = {j for j, v in enumerate(w, 1) if v == maxw} listw maxh = max(h) max(h) maxh ans = maxh + maxw maxh + maxw ans w = [0] * W [0] * W w listh = {i for i, v in enumerate(h, 1) if v == maxh} listh cnt = len(listh) * len(listw) len(listh) * len(listw) cnt H, W, M = map(int, input().split()) map(int, input().split()) H h = [0] * H [0] * H h Mem = [tuple(map(int, input().split())) for _ in range(M) ] [tuple(map(int, input().split())) for _ in range(M) ] Mem M = map(int, input().split()) map(int, input().split()) M maxw = max(w) max(w) maxw ans = maxh + maxw - 1 maxh + maxw - 1 ans W, M = map(int, input().split()) map(int, input().split()) W
H, W, M = map(int, input().split())
 
h = [0] * H
w = [0] * W
Mem = [tuple(map(int, input().split())) for _ in range(M) ]
for i, j in Mem:
  h[i-1] += 1
  w[j-1] += 1

maxh = max(h)
maxw = max(w)
 
listh = {i for i, v in enumerate(h, 1) if v == maxh}
listw = {j for j, v in enumerate(w, 1) if v == maxw}

cnt = len(listh) * len(listw)

for i, j in Mem:
  if i in listh and j in listw:
    cnt -= 1
 
if cnt:
  ans = maxh + maxw
else:
  ans = maxh + maxw - 1

print(ans)