from collections import deque
H, W, M = map(int, input().split())
bomb = []
counth = [0 for _ in range(H)]
countw = [0 for _ in range(W)]
for _ in range(M):
  h, w = map(int, input().split())
  h -= 1
  w -= 1
  bomb.append(h+ w*H)
  counth[h] += 1 
  countw[w] += 1


maxh = max(counth)
maxw = max(countw)

counth = deque(counth)
countw = deque(countw)

index_h = deque([])
index_w = []
for k in range(H):
  h = counth.popleft()
  if h == maxh:
    index_h.append(k)
lenh = len(index_h)

for k in range(W):
  w = countw.popleft()
  if w == maxw:
    index_w.append(k)
    lenw = len(index_w)
    if lenh*lenw > M:
      print(maxh + maxw)
      exit()    

ans = maxh + maxw - 1

bomb.sort()
bomb = deque(bomb)
kouho = []
for i in range(lenh):
  h = index_h.pop()
  for j in range(lenw):
    w = index_w[j]
    kouho.append(h+ H*w)
kouho.sort()
kouho = deque(kouho)
B = bomb.popleft()
K = kouho.popleft()
while True:
  if B > K:
    ans += 1
    break
  elif B == K:
    if len(kouho) == 0:
      break
    else:
      K = kouho.popleft()
  else:
    if len(bomb) == 0:
      ans += 1
      break
    else:
      B = bomb.popleft()
print(ans)
 from collections import deque H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M bomb = [] bomb [] 0 for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) 0 counth = [0 for _ in range(H)] counth [0 for _ in range(H)] 0 for _ in range(W) for _ in range(W) _ range(W) range W for _ in range(W) 0 countw = [0 for _ in range(W)] countw [0 for _ in range(W)] for _ in range(M):
  h, w = map(int, input().split())
  h -= 1
  w -= 1
  bomb.append(h+ w*H)
  counth[h] += 1 
  countw[w] += 1 _ range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w h -= 1 h 1 w -= 1 w 1 bomb.append(h+ w*H) bomb.append bomb append h+ w*H h w*H w H counth[h] += 1 counth[h] counth h 1 countw[w] += 1 countw[w] countw w 1 maxh = max(counth) maxh max(counth) max counth maxw = max(countw) maxw max(countw) max countw counth = deque(counth) counth deque(counth) deque counth countw = deque(countw) countw deque(countw) deque countw index_h = deque([]) index_h deque([]) deque [] index_w = [] index_w [] for k in range(H):
  h = counth.popleft()
  if h == maxh:
    index_h.append(k) k range(H) range H h = counth.popleft() h counth.popleft() counth.popleft counth popleft if h == maxh:
    index_h.append(k) h == maxh h maxh index_h.append(k) index_h.append index_h append k lenh = len(index_h) lenh len(index_h) len index_h for k in range(W):
  w = countw.popleft()
  if w == maxw:
    index_w.append(k)
    lenw = len(index_w)
    if lenh*lenw > M:
      print(maxh + maxw)
      exit()     k range(W) range W w = countw.popleft() w countw.popleft() countw.popleft countw popleft if w == maxw:
    index_w.append(k)
    lenw = len(index_w)
    if lenh*lenw > M:
      print(maxh + maxw)
      exit()     w == maxw w maxw index_w.append(k) index_w.append index_w append k lenw = len(index_w) lenw len(index_w) len index_w if lenh*lenw > M:
      print(maxh + maxw)
      exit()     lenh*lenw > M lenh*lenw lenh lenw M print(maxh + maxw) print maxh + maxw maxh maxw exit() exit ans = maxh + maxw - 1 ans maxh + maxw - 1 maxh + maxw maxh maxw 1 bomb.sort() bomb.sort bomb sort bomb = deque(bomb) bomb deque(bomb) deque bomb kouho = [] kouho [] for i in range(lenh):
  h = index_h.pop()
  for j in range(lenw):
    w = index_w[j]
    kouho.append(h+ H*w) i range(lenh) range lenh h = index_h.pop() h index_h.pop() index_h.pop index_h pop for j in range(lenw):
    w = index_w[j]
    kouho.append(h+ H*w) j range(lenw) range lenw w = index_w[j] w index_w[j] index_w j kouho.append(h+ H*w) kouho.append kouho append h+ H*w h H*w H w kouho.sort() kouho.sort kouho sort kouho = deque(kouho) kouho deque(kouho) deque kouho B = bomb.popleft() B bomb.popleft() bomb.popleft bomb popleft K = kouho.popleft() K kouho.popleft() kouho.popleft kouho popleft while True:
  if B > K:
    ans += 1
    break
  elif B == K:
    if len(kouho) == 0:
      break
    else:
      K = kouho.popleft()
  else:
    if len(bomb) == 0:
      ans += 1
      break
    else:
      B = bomb.popleft() True if B > K:
    ans += 1
    break
  elif B == K:
    if len(kouho) == 0:
      break
    else:
      K = kouho.popleft()
  else:
    if len(bomb) == 0:
      ans += 1
      break
    else:
      B = bomb.popleft() B > K B K ans += 1 ans 1 break elif B == K:
    if len(kouho) == 0:
      break
    else:
      K = kouho.popleft()
   B == K B K if len(kouho) == 0:
      break
    else:
      K = kouho.popleft()
   len(kouho) == 0 len(kouho) len kouho 0 break K = kouho.popleft() K kouho.popleft() kouho.popleft kouho popleft if len(bomb) == 0:
      ans += 1
      break
    else:
      B = bomb.popleft() len(bomb) == 0 len(bomb) len bomb 0 ans += 1 ans 1 break B = bomb.popleft() B bomb.popleft() bomb.popleft bomb popleft print(ans) print ans counth = [0 for _ in range(H)] [0 for _ in range(H)] counth h = counth.popleft() counth.popleft() h bomb = [] [] bomb kouho = deque(kouho) deque(kouho) kouho bomb = deque(bomb) deque(bomb) bomb w = map(int, input().split()) map(int, input().split()) w index_h = deque([]) deque([]) index_h lenw = len(index_w) len(index_w) lenw ans += 1 1 ans counth = deque(counth) deque(counth) counth h, w = map(int, input().split()) map(int, input().split()) h countw = deque(countw) deque(countw) countw w = index_w[j] index_w[j] w h -= 1 1 h h = index_h.pop() index_h.pop() h B = bomb.popleft() bomb.popleft() B w = countw.popleft() countw.popleft() w w -= 1 1 w maxw = max(countw) max(countw) maxw B = bomb.popleft() bomb.popleft() B M = map(int, input().split()) map(int, input().split()) M K = kouho.popleft() kouho.popleft() K index_w = [] [] index_w countw = [0 for _ in range(W)] [0 for _ in range(W)] countw K = kouho.popleft() kouho.popleft() K ans += 1 1 ans kouho = [] [] kouho W, M = map(int, input().split()) map(int, input().split()) W ans = maxh + maxw - 1 maxh + maxw - 1 ans H, W, M = map(int, input().split()) map(int, input().split()) H lenh = len(index_h) len(index_h) lenh maxh = max(counth) max(counth) maxh
from collections import deque
H, W, M = map(int, input().split())
bomb = []
counth = [0 for _ in range(H)]
countw = [0 for _ in range(W)]
for _ in range(M):
  h, w = map(int, input().split())
  h -= 1
  w -= 1
  bomb.append(h+ w*H)
  counth[h] += 1 
  countw[w] += 1


maxh = max(counth)
maxw = max(countw)

counth = deque(counth)
countw = deque(countw)

index_h = deque([])
index_w = []
for k in range(H):
  h = counth.popleft()
  if h == maxh:
    index_h.append(k)
lenh = len(index_h)

for k in range(W):
  w = countw.popleft()
  if w == maxw:
    index_w.append(k)
    lenw = len(index_w)
    if lenh*lenw > M:
      print(maxh + maxw)
      exit()    

ans = maxh + maxw - 1

bomb.sort()
bomb = deque(bomb)
kouho = []
for i in range(lenh):
  h = index_h.pop()
  for j in range(lenw):
    w = index_w[j]
    kouho.append(h+ H*w)
kouho.sort()
kouho = deque(kouho)
B = bomb.popleft()
K = kouho.popleft()
while True:
  if B > K:
    ans += 1
    break
  elif B == K:
    if len(kouho) == 0:
      break
    else:
      K = kouho.popleft()
  else:
    if len(bomb) == 0:
      ans += 1
      break
    else:
      B = bomb.popleft()
print(ans)

