import itertools
H,W,N=[int(s) for s in input().split()]
hls=[0 for _ in range(H+1)]
wls=[0 for _ in range(W+1)]
bombs=[set() for _ in range(H+1)]
for _ in range(N):
  h,w=[int(s) for s in input().split()]
  hls[h]+=1
  wls[w]+=1
  bombs[h].add(w)
hmax=max(hls)
wmax=max(wls)
hmaxls=[i for i in range(H+1) if hls[i]==hmax]
wmaxls=[i for i in range(W+1) if wls[i]==wmax]
for h,w in itertools.product(hmaxls,wmaxls):
  if not(w in bombs[h]):
    print(hmax+wmax)
    exit()
else:
  print(hmax+wmax-1) import itertools itertools int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s H,W,N=[int(s) for s in input().split()] H [int(s) for s in input().split()] W N 0 for _ in range(H+1) for _ in range(H+1) _ range(H+1) range H+1 H 1 for _ in range(H+1) 0 hls=[0 for _ in range(H+1)] hls [0 for _ in range(H+1)] 0 for _ in range(W+1) for _ in range(W+1) _ range(W+1) range W+1 W 1 for _ in range(W+1) 0 wls=[0 for _ in range(W+1)] wls [0 for _ in range(W+1)] set() for _ in range(H+1) for _ in range(H+1) _ range(H+1) range H+1 H 1 for _ in range(H+1) set() set bombs=[set() for _ in range(H+1)] bombs [set() for _ in range(H+1)] for _ in range(N):
  h,w=[int(s) for s in input().split()]
  hls[h]+=1
  wls[w]+=1
  bombs[h].add(w) _ range(N) range N int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s h,w=[int(s) for s in input().split()] h [int(s) for s in input().split()] w hls[h]+=1 hls[h] hls h 1 wls[w]+=1 wls[w] wls w 1 bombs[h].add(w) [h].add [h] bombs h add w hmax=max(hls) hmax max(hls) max hls wmax=max(wls) wmax max(wls) max wls i for i in range(H+1) if hls[i]==hmax for i in range(H+1) if hls[i]==hmax i range(H+1) range H+1 H 1 hls[i]==hmax hls[i] hls i hmax if hls[i]==hmax i hmaxls=[i for i in range(H+1) if hls[i]==hmax] hmaxls [i for i in range(H+1) if hls[i]==hmax] i for i in range(W+1) if wls[i]==wmax for i in range(W+1) if wls[i]==wmax i range(W+1) range W+1 W 1 wls[i]==wmax wls[i] wls i wmax if wls[i]==wmax i wmaxls=[i for i in range(W+1) if wls[i]==wmax] wmaxls [i for i in range(W+1) if wls[i]==wmax] for h,w in itertools.product(hmaxls,wmaxls):
  if not(w in bombs[h]):
    print(hmax+wmax)
    exit()
else:
  print(hmax+wmax-1) h w itertools.product(hmaxls,wmaxls) itertools.product itertools product hmaxls wmaxls if not(w in bombs[h]):
    print(hmax+wmax)
    exit() not(w in bombs[h]) w in bombs[h] w bombs[h] bombs h print(hmax+wmax) print hmax+wmax hmax wmax exit() exit print(hmax+wmax-1) print hmax+wmax-1 hmax+wmax hmax wmax 1 W,N=[int(s) for s in input().split()] [int(s) for s in input().split()] W wmaxls=[i for i in range(W+1) if wls[i]==wmax] [i for i in range(W+1) if wls[i]==wmax] wmaxls hls=[0 for _ in range(H+1)] [0 for _ in range(H+1)] hls h,w=[int(s) for s in input().split()] [int(s) for s in input().split()] h w=[int(s) for s in input().split()] [int(s) for s in input().split()] w H,W,N=[int(s) for s in input().split()] [int(s) for s in input().split()] H wmax=max(wls) max(wls) wmax wls=[0 for _ in range(W+1)] [0 for _ in range(W+1)] wls bombs=[set() for _ in range(H+1)] [set() for _ in range(H+1)] bombs hmax=max(hls) max(hls) hmax hmaxls=[i for i in range(H+1) if hls[i]==hmax] [i for i in range(H+1) if hls[i]==hmax] hmaxls N=[int(s) for s in input().split()] [int(s) for s in input().split()] N
import itertools
H,W,N=[int(s) for s in input().split()]
hls=[0 for _ in range(H+1)]
wls=[0 for _ in range(W+1)]
bombs=[set() for _ in range(H+1)]
for _ in range(N):
  h,w=[int(s) for s in input().split()]
  hls[h]+=1
  wls[w]+=1
  bombs[h].add(w)
hmax=max(hls)
wmax=max(wls)
hmaxls=[i for i in range(H+1) if hls[i]==hmax]
wmaxls=[i for i in range(W+1) if wls[i]==wmax]
for h,w in itertools.product(hmaxls,wmaxls):
  if not(w in bombs[h]):
    print(hmax+wmax)
    exit()
else:
  print(hmax+wmax-1)