from collections import defaultdict
def solve():
  H, W, M = map(int, input().split())
  bomb = defaultdict(lambda: 0)
  lis_h = [0]*H
  lis_w = [0]*W
  for _ in range(M):
    h,w = map(int, input().split())
    h -= 1
    w -= 1
    bomb[(h,w)] = 1
    lis_h[h] += 1
    lis_w[w] += 1
  m_h = max(lis_h)
  m_w = max(lis_w)
  m_h_lis = []
  m_w_lis = []
  for i in range(H):
    if lis_h[i]==m_h:
      m_h_lis.append(i)
  for i in range(W):
    if lis_w[i]==m_w:
      m_w_lis.append(i)
  ans = 0
  for h in m_h_lis:
    for w in m_w_lis:
      if bomb[(h,w)]==0:
        return m_h+m_w
  return m_h+m_w-1
print(solve()) from collections import defaultdict def solve():
  H, W, M = map(int, input().split())
  bomb = defaultdict(lambda: 0)
  lis_h = [0]*H
  lis_w = [0]*W
  for _ in range(M):
    h,w = map(int, input().split())
    h -= 1
    w -= 1
    bomb[(h,w)] = 1
    lis_h[h] += 1
    lis_w[w] += 1
  m_h = max(lis_h)
  m_w = max(lis_w)
  m_h_lis = []
  m_w_lis = []
  for i in range(H):
    if lis_h[i]==m_h:
      m_h_lis.append(i)
  for i in range(W):
    if lis_w[i]==m_w:
      m_w_lis.append(i)
  ans = 0
  for h in m_h_lis:
    for w in m_w_lis:
      if bomb[(h,w)]==0:
        return m_h+m_w
  return m_h+m_w-1 solve H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M bomb = defaultdict(lambda: 0) bomb defaultdict(lambda: 0) defaultdict lambda: 0 0 lis_h = [0]*H lis_h [0]*H [0] 0 H lis_w = [0]*W lis_w [0]*W [0] 0 W for _ in range(M):
    h,w = map(int, input().split())
    h -= 1
    w -= 1
    bomb[(h,w)] = 1
    lis_h[h] += 1
    lis_w[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[(h,w)] = 1 bomb[(h,w)] bomb (h,w) h w 1 lis_h[h] += 1 lis_h[h] lis_h h 1 lis_w[w] += 1 lis_w[w] lis_w w 1 m_h = max(lis_h) m_h max(lis_h) max lis_h m_w = max(lis_w) m_w max(lis_w) max lis_w m_h_lis = [] m_h_lis [] m_w_lis = [] m_w_lis [] for i in range(H):
    if lis_h[i]==m_h:
      m_h_lis.append(i)
   i range(H) range H if lis_h[i]==m_h:
      m_h_lis.append(i)
   lis_h[i]==m_h lis_h[i] lis_h i m_h m_h_lis.append(i) m_h_lis.append m_h_lis append i for i in range(W):
    if lis_w[i]==m_w:
      m_w_lis.append(i)
   i range(W) range W if lis_w[i]==m_w:
      m_w_lis.append(i)
   lis_w[i]==m_w lis_w[i] lis_w i m_w m_w_lis.append(i) m_w_lis.append m_w_lis append i ans = 0 ans 0 for h in m_h_lis:
    for w in m_w_lis:
      if bomb[(h,w)]==0:
        return m_h+m_w
   h m_h_lis for w in m_w_lis:
      if bomb[(h,w)]==0:
        return m_h+m_w
   w m_w_lis if bomb[(h,w)]==0:
        return m_h+m_w
   bomb[(h,w)]==0 bomb[(h,w)] bomb (h,w) h w 0 return m_h+m_w m_h+m_w m_h m_w return m_h+m_w-1 m_h+m_w-1 m_h+m_w m_h m_w 1 print(solve()) print solve() solve def solve():
  H, W, M = map(int, input().split())
  bomb = defaultdict(lambda: 0)
  lis_h = [0]*H
  lis_w = [0]*W
  for _ in range(M):
    h,w = map(int, input().split())
    h -= 1
    w -= 1
    bomb[(h,w)] = 1
    lis_h[h] += 1
    lis_w[w] += 1
  m_h = max(lis_h)
  m_w = max(lis_w)
  m_h_lis = []
  m_w_lis = []
  for i in range(H):
    if lis_h[i]==m_h:
      m_h_lis.append(i)
  for i in range(W):
    if lis_w[i]==m_w:
      m_w_lis.append(i)
  ans = 0
  for h in m_h_lis:
    for w in m_w_lis:
      if bomb[(h,w)]==0:
        return m_h+m_w
  return m_h+m_w-1 def solve():
  H, W, M = map(int, input().split())
  bomb = defaultdict(lambda: 0)
  lis_h = [0]*H
  lis_w = [0]*W
  for _ in range(M):
    h,w = map(int, input().split())
    h -= 1
    w -= 1
    bomb[(h,w)] = 1
    lis_h[h] += 1
    lis_w[w] += 1
  m_h = max(lis_h)
  m_w = max(lis_w)
  m_h_lis = []
  m_w_lis = []
  for i in range(H):
    if lis_h[i]==m_h:
      m_h_lis.append(i)
  for i in range(W):
    if lis_w[i]==m_w:
      m_w_lis.append(i)
  ans = 0
  for h in m_h_lis:
    for w in m_w_lis:
      if bomb[(h,w)]==0:
        return m_h+m_w
  return m_h+m_w-1 solve
from collections import defaultdict
def solve():
  H, W, M = map(int, input().split())
  bomb = defaultdict(lambda: 0)
  lis_h = [0]*H
  lis_w = [0]*W
  for _ in range(M):
    h,w = map(int, input().split())
    h -= 1
    w -= 1
    bomb[(h,w)] = 1
    lis_h[h] += 1
    lis_w[w] += 1
  m_h = max(lis_h)
  m_w = max(lis_w)
  m_h_lis = []
  m_w_lis = []
  for i in range(H):
    if lis_h[i]==m_h:
      m_h_lis.append(i)
  for i in range(W):
    if lis_w[i]==m_w:
      m_w_lis.append(i)
  ans = 0
  for h in m_h_lis:
    for w in m_w_lis:
      if bomb[(h,w)]==0:
        return m_h+m_w
  return m_h+m_w-1
print(solve())
