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

hs = [0] * H
ws = [0] * W
s = set()
for i in range(M):
  h,w = map(int, input().split())
  hs[h-1] += 1
  ws[w-1] += 1
  s.add((h-1,w-1))
  
mh = 0
mw = 0
for i in range(H):
  mh = max(mh, hs[i])
for j in range(W):
  mw = max(mw, ws[j])
  
i_s = list()
j_s = list()
for i in range(H):
  if mh == hs[i]:
    i_s.append(i)
for j in range(W):
  if mw == ws[j]:
    j_s.append(j)

ans = mh + mw
for i in i_s:
  for j in j_s:
    if (i,j) in s:
      continue
    print(ans)
    exit()
ans -= 1
print(ans) H,W,M = map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M hs = [0] * H hs [0] * H [0] 0 H ws = [0] * W ws [0] * W [0] 0 W s = set() s set() set for i in range(M):
  h,w = map(int, input().split())
  hs[h-1] += 1
  ws[w-1] += 1
  s.add((h-1,w-1))
   i range(M) range M h,w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w hs[h-1] += 1 hs[h-1] hs h-1 h 1 1 ws[w-1] += 1 ws[w-1] ws w-1 w 1 1 s.add((h-1,w-1)) s.add s add (h-1,w-1) h-1 h 1 w-1 w 1 mh = 0 mh 0 mw = 0 mw 0 for i in range(H):
  mh = max(mh, hs[i]) i range(H) range H mh = max(mh, hs[i]) mh max(mh, hs[i]) max mh hs[i] hs i for j in range(W):
  mw = max(mw, ws[j])
   j range(W) range W mw = max(mw, ws[j]) mw max(mw, ws[j]) max mw ws[j] ws j i_s = list() i_s list() list j_s = list() j_s list() list for i in range(H):
  if mh == hs[i]:
    i_s.append(i) i range(H) range H if mh == hs[i]:
    i_s.append(i) mh == hs[i] mh hs[i] hs i i_s.append(i) i_s.append i_s append i for j in range(W):
  if mw == ws[j]:
    j_s.append(j) j range(W) range W if mw == ws[j]:
    j_s.append(j) mw == ws[j] mw ws[j] ws j j_s.append(j) j_s.append j_s append j ans = mh + mw ans mh + mw mh mw for i in i_s:
  for j in j_s:
    if (i,j) in s:
      continue
    print(ans)
    exit() i i_s for j in j_s:
    if (i,j) in s:
      continue
    print(ans)
    exit() j j_s if (i,j) in s:
      continue
     (i,j) in s (i,j) i j s continue print(ans) print ans exit() exit ans -= 1 ans 1 print(ans) print ans ans = mh + mw mh + mw ans h,w = map(int, input().split()) map(int, input().split()) h s = set() set() s ans -= 1 1 ans w = map(int, input().split()) map(int, input().split()) w hs = [0] * H [0] * H hs mw = 0 0 mw i_s = list() list() i_s H,W,M = map(int,input().split()) map(int,input().split()) H mw = max(mw, ws[j]) max(mw, ws[j]) mw M = map(int,input().split()) map(int,input().split()) M mh = max(mh, hs[i]) max(mh, hs[i]) mh mh = 0 0 mh j_s = list() list() j_s ws = [0] * W [0] * W ws W,M = map(int,input().split()) map(int,input().split()) W
H,W,M = map(int,input().split())

hs = [0] * H
ws = [0] * W
s = set()
for i in range(M):
  h,w = map(int, input().split())
  hs[h-1] += 1
  ws[w-1] += 1
  s.add((h-1,w-1))
  
mh = 0
mw = 0
for i in range(H):
  mh = max(mh, hs[i])
for j in range(W):
  mw = max(mw, ws[j])
  
i_s = list()
j_s = list()
for i in range(H):
  if mh == hs[i]:
    i_s.append(i)
for j in range(W):
  if mw == ws[j]:
    j_s.append(j)

ans = mh + mw
for i in i_s:
  for j in j_s:
    if (i,j) in s:
      continue
    print(ans)
    exit()
ans -= 1
print(ans)