from collections import deque
H, W, M = map(int, input().split())
bomb = []
counth = [0 for k in range(H)]
countw = [0 for k in range(W)]
for k 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)

def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            #return mid
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    #return None
    return False


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

for k in range(W):
  w = countw.popleft()
  if w == maxw:
    index_w.append(k)

ans = maxh + maxw - 1
lenh = len(index_h)
lenw = len(index_w)


if lenh*lenw > M:
  ans += 1
else:
  bomb.sort()
  kouho = []
  for i in range(lenh):
    h = index_h.pop()
    for j in range(lenw):
      w = index_w[j]
      kouho.append(h+ H*w)
  for K in kouho:
    if binary_search(bomb, K):
      continue
    else:
      ans += 1
      break
    
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 k in range(H) for k in range(H) k range(H) range H for k in range(H) 0 counth = [0 for k in range(H)] counth [0 for k in range(H)] 0 for k in range(W) for k in range(W) k range(W) range W for k in range(W) 0 countw = [0 for k in range(W)] countw [0 for k in range(W)] for k in range(M):
  h, w = map(int, input().split())
  h -= 1
  w -= 1
  bomb.append(h+ w*H)
  counth[h] += 1 
  countw[w] += 1 k 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 def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            #return mid
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    #return None
    return False binary_search low = 0 low 0 high = len(list) - 1 high len(list) - 1 len(list) len list 1 while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            #return mid
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    #return None
     low <= high low high mid = (low + high) //2 mid (low + high) //2 low + high low high 2 guess = list[mid] guess list[mid] list mid if guess == item:
            #return mid
            return True
         guess == item guess item return True True if guess > item:
            high = mid -1
        else:
            low = mid + 1

    #return None
     guess > item guess item high = mid -1 high mid -1 mid 1 low = mid + 1 low mid + 1 mid 1 return False False list list item item 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 for k in range(W):
  w = countw.popleft()
  if w == maxw:
    index_w.append(k) k range(W) range W w = countw.popleft() w countw.popleft() countw.popleft countw popleft if w == maxw:
    index_w.append(k) w == maxw w maxw index_w.append(k) index_w.append index_w append k ans = maxh + maxw - 1 ans maxh + maxw - 1 maxh + maxw maxh maxw 1 lenh = len(index_h) lenh len(index_h) len index_h lenw = len(index_w) lenw len(index_w) len index_w if lenh*lenw > M:
  ans += 1
else:
  bomb.sort()
  kouho = []
  for i in range(lenh):
    h = index_h.pop()
    for j in range(lenw):
      w = index_w[j]
      kouho.append(h+ H*w)
  for K in kouho:
    if binary_search(bomb, K):
      continue
    else:
      ans += 1
      break
     lenh*lenw > M lenh*lenw lenh lenw M ans += 1 ans 1 bomb.sort() bomb.sort bomb sort 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 for K in kouho:
    if binary_search(bomb, K):
      continue
    else:
      ans += 1
      break
     K kouho if binary_search(bomb, K):
      continue
    else:
      ans += 1
      break
     binary_search(bomb, K) binary_search bomb K continue ans += 1 ans 1 break print(ans) print ans countw = deque(countw) deque(countw) countw lenh = len(index_h) len(index_h) lenh h = index_h.pop() index_h.pop() h countw = [0 for k in range(W)] [0 for k in range(W)] countw H, W, M = map(int, input().split()) map(int, input().split()) H index_w = [] [] index_w def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            #return mid
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    #return None
    return False def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            #return mid
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    #return None
    return False binary_search h = counth.popleft() counth.popleft() h ans = maxh + maxw - 1 maxh + maxw - 1 ans w = countw.popleft() countw.popleft() w counth = [0 for k in range(H)] [0 for k in range(H)] counth h, w = map(int, input().split()) map(int, input().split()) h h -= 1 1 h counth = deque(counth) deque(counth) counth w = map(int, input().split()) map(int, input().split()) w kouho = [] [] kouho ans += 1 1 ans W, M = map(int, input().split()) map(int, input().split()) W lenw = len(index_w) len(index_w) lenw bomb = [] [] bomb M = map(int, input().split()) map(int, input().split()) M w = index_w[j] index_w[j] w w -= 1 1 w maxh = max(counth) max(counth) maxh index_h = deque([]) deque([]) index_h maxw = max(countw) max(countw) maxw ans += 1 1 ans
from collections import deque
H, W, M = map(int, input().split())
bomb = []
counth = [0 for k in range(H)]
countw = [0 for k in range(W)]
for k 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)

def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            #return mid
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    #return None
    return False


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

for k in range(W):
  w = countw.popleft()
  if w == maxw:
    index_w.append(k)

ans = maxh + maxw - 1
lenh = len(index_h)
lenw = len(index_w)


if lenh*lenw > M:
  ans += 1
else:
  bomb.sort()
  kouho = []
  for i in range(lenh):
    h = index_h.pop()
    for j in range(lenw):
      w = index_w[j]
      kouho.append(h+ H*w)
  for K in kouho:
    if binary_search(bomb, K):
      continue
    else:
      ans += 1
      break
    
print(ans)


