import sys
H, W, M = map(int, input().split())
hn = [0]*H
wn = [0]*W
flag = set()
for i in range(M):
  h, w = map(int, input().split())
  hn[h-1] += 1
  wn[w-1] += 1
  flag.add((h,w))
  
#hrank = sorted(hn, key=lambda t:-t[1])
#wrank = sorted(wn, key=lambda t:-t[1])

hmax = max(hn)
wmax = max(wn)

hmaxlist = {i+1 for i,h in enumerate(hn) if h == hmax}
#for h in hn:
#  if h == hmax:
#    hmaxlist.append(h)
  
wmaxlist = {i+1 for i,w in enumerate(wn) if w == wmax}
#for w in wn:
#  if w == wmax:
#    wmaxlist.append(w)
  

for i in hmaxlist:
  for j in wmaxlist:
    if (i,j) not in flag:
      print(hmax+wmax)
      sys.exit()
print(hmax+wmax-1) import sys sys H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M hn = [0]*H hn [0]*H [0] 0 H wn = [0]*W wn [0]*W [0] 0 W flag = set() flag set() set for i in range(M):
  h, w = map(int, input().split())
  hn[h-1] += 1
  wn[w-1] += 1
  flag.add((h,w))
  
#hrank = sorted(hn, key=lambda t:-t[1])
#wrank = sorted(wn, key=lambda t:-t[1]) i range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w hn[h-1] += 1 hn[h-1] hn h-1 h 1 1 wn[w-1] += 1 wn[w-1] wn w-1 w 1 1 flag.add((h,w)) flag.add flag add (h,w) h w hmax = max(hn) hmax max(hn) max hn wmax = max(wn) wmax max(wn) max wn i+1 for i,h in enumerate(hn) if h == hmax for i,h in enumerate(hn) if h == hmax i h enumerate(hn) enumerate hn h == hmax h hmax if h == hmax i+1 i 1 hmaxlist = {i+1 for i,h in enumerate(hn) if h == hmax} hmaxlist i+1 for i,w in enumerate(wn) if w == wmax for i,w in enumerate(wn) if w == wmax i w enumerate(wn) enumerate wn w == wmax w wmax if w == wmax i+1 i 1 wmaxlist = {i+1 for i,w in enumerate(wn) if w == wmax} wmaxlist for i in hmaxlist:
  for j in wmaxlist:
    if (i,j) not in flag:
      print(hmax+wmax)
      sys.exit() i hmaxlist for j in wmaxlist:
    if (i,j) not in flag:
      print(hmax+wmax)
      sys.exit() j wmaxlist if (i,j) not in flag:
      print(hmax+wmax)
      sys.exit() (i,j) not in flag (i,j) i j flag print(hmax+wmax) print hmax+wmax hmax wmax sys.exit() sys.exit sys exit print(hmax+wmax-1) print hmax+wmax-1 hmax+wmax hmax wmax 1 wmax = max(wn) max(wn) wmax wmaxlist = {i+1 for i,w in enumerate(wn) if w == wmax} wmaxlist w = map(int, input().split()) map(int, input().split()) w H, W, M = map(int, input().split()) map(int, input().split()) H hn = [0]*H [0]*H hn hmaxlist = {i+1 for i,h in enumerate(hn) if h == hmax} hmaxlist flag = set() set() flag h, w = map(int, input().split()) map(int, input().split()) h M = map(int, input().split()) map(int, input().split()) M W, M = map(int, input().split()) map(int, input().split()) W wn = [0]*W [0]*W wn hmax = max(hn) max(hn) hmax
import sys
H, W, M = map(int, input().split())
hn = [0]*H
wn = [0]*W
flag = set()
for i in range(M):
  h, w = map(int, input().split())
  hn[h-1] += 1
  wn[w-1] += 1
  flag.add((h,w))
  
#hrank = sorted(hn, key=lambda t:-t[1])
#wrank = sorted(wn, key=lambda t:-t[1])

hmax = max(hn)
wmax = max(wn)

hmaxlist = {i+1 for i,h in enumerate(hn) if h == hmax}
#for h in hn:
#  if h == hmax:
#    hmaxlist.append(h)
  
wmaxlist = {i+1 for i,w in enumerate(wn) if w == wmax}
#for w in wn:
#  if w == wmax:
#    wmaxlist.append(w)
  

for i in hmaxlist:
  for j in wmaxlist:
    if (i,j) not in flag:
      print(hmax+wmax)
      sys.exit()
print(hmax+wmax-1)