def calc():
  H,W,M = map(int, input().split())
  s = []
  hcount = [0]*H
  wcount = [0]*W
  for m in range(M):
    h,w = map(int, input().split())
    h = h - 1
    w = w - 1
    hcount[h] = hcount[h] + 1
    wcount[w] = wcount[w] + 1
    s.append((h,w))
  hmax = max(hcount)
  wmax = max(wcount)
  hmode = [h for h, x in enumerate(hcount) if x == hmax]
  wmode = [w for w, y in enumerate(wcount) if y == wmax]
  s = tuple(s)
  S = set(s)
  for h in hmode:
    for w in wmode:
      if ((h,w) not in S):
        return hmax + wmax
  return hmax + wmax - 1
  
if __name__ == '__main__':
    print(calc()) def calc():
  H,W,M = map(int, input().split())
  s = []
  hcount = [0]*H
  wcount = [0]*W
  for m in range(M):
    h,w = map(int, input().split())
    h = h - 1
    w = w - 1
    hcount[h] = hcount[h] + 1
    wcount[w] = wcount[w] + 1
    s.append((h,w))
  hmax = max(hcount)
  wmax = max(wcount)
  hmode = [h for h, x in enumerate(hcount) if x == hmax]
  wmode = [w for w, y in enumerate(wcount) if y == wmax]
  s = tuple(s)
  S = set(s)
  for h in hmode:
    for w in wmode:
      if ((h,w) not in S):
        return hmax + wmax
  return hmax + wmax - 1
   calc H,W,M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M s = [] s [] hcount = [0]*H hcount [0]*H [0] 0 H wcount = [0]*W wcount [0]*W [0] 0 W for m in range(M):
    h,w = map(int, input().split())
    h = h - 1
    w = w - 1
    hcount[h] = hcount[h] + 1
    wcount[w] = wcount[w] + 1
    s.append((h,w))
   m range(M) range M h,w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w h = h - 1 h h - 1 h 1 w = w - 1 w w - 1 w 1 hcount[h] = hcount[h] + 1 hcount[h] hcount h hcount[h] + 1 hcount[h] hcount h 1 wcount[w] = wcount[w] + 1 wcount[w] wcount w wcount[w] + 1 wcount[w] wcount w 1 s.append((h,w)) s.append s append (h,w) h w hmax = max(hcount) hmax max(hcount) max hcount wmax = max(wcount) wmax max(wcount) max wcount h for h, x in enumerate(hcount) if x == hmax for h, x in enumerate(hcount) if x == hmax h x enumerate(hcount) enumerate hcount x == hmax x hmax if x == hmax h hmode = [h for h, x in enumerate(hcount) if x == hmax] hmode [h for h, x in enumerate(hcount) if x == hmax] w for w, y in enumerate(wcount) if y == wmax for w, y in enumerate(wcount) if y == wmax w y enumerate(wcount) enumerate wcount y == wmax y wmax if y == wmax w wmode = [w for w, y in enumerate(wcount) if y == wmax] wmode [w for w, y in enumerate(wcount) if y == wmax] s = tuple(s) s tuple(s) tuple s S = set(s) S set(s) set s for h in hmode:
    for w in wmode:
      if ((h,w) not in S):
        return hmax + wmax
   h hmode for w in wmode:
      if ((h,w) not in S):
        return hmax + wmax
   w wmode if ((h,w) not in S):
        return hmax + wmax
   (h,w) not in S (h,w) h w S return hmax + wmax hmax + wmax hmax wmax return hmax + wmax - 1 hmax + wmax - 1 hmax + wmax hmax wmax 1 if __name__ == '__main__':
    print(calc()) __name__ == '__main__' __name__ '__main__' print(calc()) print calc() calc def calc():
  H,W,M = map(int, input().split())
  s = []
  hcount = [0]*H
  wcount = [0]*W
  for m in range(M):
    h,w = map(int, input().split())
    h = h - 1
    w = w - 1
    hcount[h] = hcount[h] + 1
    wcount[w] = wcount[w] + 1
    s.append((h,w))
  hmax = max(hcount)
  wmax = max(wcount)
  hmode = [h for h, x in enumerate(hcount) if x == hmax]
  wmode = [w for w, y in enumerate(wcount) if y == wmax]
  s = tuple(s)
  S = set(s)
  for h in hmode:
    for w in wmode:
      if ((h,w) not in S):
        return hmax + wmax
  return hmax + wmax - 1
   def calc():
  H,W,M = map(int, input().split())
  s = []
  hcount = [0]*H
  wcount = [0]*W
  for m in range(M):
    h,w = map(int, input().split())
    h = h - 1
    w = w - 1
    hcount[h] = hcount[h] + 1
    wcount[w] = wcount[w] + 1
    s.append((h,w))
  hmax = max(hcount)
  wmax = max(wcount)
  hmode = [h for h, x in enumerate(hcount) if x == hmax]
  wmode = [w for w, y in enumerate(wcount) if y == wmax]
  s = tuple(s)
  S = set(s)
  for h in hmode:
    for w in wmode:
      if ((h,w) not in S):
        return hmax + wmax
  return hmax + wmax - 1
   calc
def calc():
  H,W,M = map(int, input().split())
  s = []
  hcount = [0]*H
  wcount = [0]*W
  for m in range(M):
    h,w = map(int, input().split())
    h = h - 1
    w = w - 1
    hcount[h] = hcount[h] + 1
    wcount[w] = wcount[w] + 1
    s.append((h,w))
  hmax = max(hcount)
  wmax = max(wcount)
  hmode = [h for h, x in enumerate(hcount) if x == hmax]
  wmode = [w for w, y in enumerate(wcount) if y == wmax]
  s = tuple(s)
  S = set(s)
  for h in hmode:
    for w in wmode:
      if ((h,w) not in S):
        return hmax + wmax
  return hmax + wmax - 1
  
if __name__ == '__main__':
    print(calc())