H,W,M = map(int, input().split())
width = [0]*W
height = [0]*H

st = set()
for i in range(M):
  y, x = map(int, input().split())
  st.add((x - 1,y - 1))
  width[x-1] += 1
  height[y-1] += 1

maxW = max(width)
maxH = max(height)

indexW = [i for i, v in enumerate(width) if v == maxW]
indexH = [i for i, v in enumerate(height) if v == maxH]

ans = maxW + maxH 

#それぞれ列と行の最大値の中から適当に１つずつ列と行を選ぶ
tmpX = indexW[0]
tmpY = indexH[0]

#HeightとWidthのそれぞれの最大値の点(x, y)に爆弾がない場合があるかどうか
flag = 0

#print(f"indexH {indexH}")
#print(f"indexW {indexW}")

#Heightの最大値と、widthのそれぞれを全探索
for x in indexW:
  y = tmpY
  if not (x, y) in st:
    flag = 1
    break


for y in indexH:
  x = tmpX
  if not (x, y) in st:
    flag = 1
    break

if flag == 1:
  print(ans)
else:
  print(ans - 1) H,W,M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M width = [0]*W width [0]*W [0] 0 W height = [0]*H height [0]*H [0] 0 H st = set() st set() set for i in range(M):
  y, x = map(int, input().split())
  st.add((x - 1,y - 1))
  width[x-1] += 1
  height[y-1] += 1 i range(M) range M y, x = map(int, input().split()) y map(int, input().split()) map int input().split() ().split () input split x st.add((x - 1,y - 1)) st.add st add (x - 1,y - 1) x - 1 x 1 y - 1 y 1 width[x-1] += 1 width[x-1] width x-1 x 1 1 height[y-1] += 1 height[y-1] height y-1 y 1 1 maxW = max(width) maxW max(width) max width maxH = max(height) maxH max(height) max height i for i, v in enumerate(width) if v == maxW for i, v in enumerate(width) if v == maxW i v enumerate(width) enumerate width v == maxW v maxW if v == maxW i indexW = [i for i, v in enumerate(width) if v == maxW] indexW [i for i, v in enumerate(width) if v == maxW] i for i, v in enumerate(height) if v == maxH for i, v in enumerate(height) if v == maxH i v enumerate(height) enumerate height v == maxH v maxH if v == maxH i indexH = [i for i, v in enumerate(height) if v == maxH] indexH [i for i, v in enumerate(height) if v == maxH] ans = maxW + maxH ans maxW + maxH maxW maxH tmpX = indexW[0] tmpX indexW[0] indexW 0 tmpY = indexH[0] tmpY indexH[0] indexH 0 flag = 0 flag 0 for x in indexW:
  y = tmpY
  if not (x, y) in st:
    flag = 1
    break x indexW y = tmpY y tmpY if not (x, y) in st:
    flag = 1
    break not (x, y) in st (x, y) in st (x, y) x y st flag = 1 flag 1 break for y in indexH:
  x = tmpX
  if not (x, y) in st:
    flag = 1
    break y indexH x = tmpX x tmpX if not (x, y) in st:
    flag = 1
    break not (x, y) in st (x, y) in st (x, y) x y st flag = 1 flag 1 break if flag == 1:
  print(ans)
else:
  print(ans - 1) flag == 1 flag 1 print(ans) print ans print(ans - 1) print ans - 1 ans 1 x = map(int, input().split()) map(int, input().split()) x indexH = [i for i, v in enumerate(height) if v == maxH] [i for i, v in enumerate(height) if v == maxH] indexH ans = maxW + maxH maxW + maxH ans x = tmpX tmpX x W,M = map(int, input().split()) map(int, input().split()) W maxH = max(height) max(height) maxH M = map(int, input().split()) map(int, input().split()) M y, x = map(int, input().split()) map(int, input().split()) y y = tmpY tmpY y width = [0]*W [0]*W width height = [0]*H [0]*H height tmpY = indexH[0] indexH[0] tmpY H,W,M = map(int, input().split()) map(int, input().split()) H maxW = max(width) max(width) maxW indexW = [i for i, v in enumerate(width) if v == maxW] [i for i, v in enumerate(width) if v == maxW] indexW tmpX = indexW[0] indexW[0] tmpX flag = 1 1 flag flag = 1 1 flag st = set() set() st flag = 0 0 flag
H,W,M = map(int, input().split())
width = [0]*W
height = [0]*H

st = set()
for i in range(M):
  y, x = map(int, input().split())
  st.add((x - 1,y - 1))
  width[x-1] += 1
  height[y-1] += 1

maxW = max(width)
maxH = max(height)

indexW = [i for i, v in enumerate(width) if v == maxW]
indexH = [i for i, v in enumerate(height) if v == maxH]

ans = maxW + maxH 

#それぞれ列と行の最大値の中から適当に１つずつ列と行を選ぶ
tmpX = indexW[0]
tmpY = indexH[0]

#HeightとWidthのそれぞれの最大値の点(x, y)に爆弾がない場合があるかどうか
flag = 0

#print(f"indexH {indexH}")
#print(f"indexW {indexW}")

#Heightの最大値と、widthのそれぞれを全探索
for x in indexW:
  y = tmpY
  if not (x, y) in st:
    flag = 1
    break


for y in indexH:
  x = tmpX
  if not (x, y) in st:
    flag = 1
    break

if flag == 1:
  print(ans)
else:
  print(ans - 1)
