h,w,m=map(int,input().split())
a=[0]*h;b=[0]*w
s=set()
for _ in range(m):
  x,y=map(lambda x:int(x)-1,input().split())
  a[x]+=1;b[y]+=1
  s.add(x*10**6+y)
ma=max(a);mb=max(b)
c=[i for i,v in enumerate(a) if v==ma]
d=[i for i,v in enumerate(b) if v==mb]
for x in c:
  for y in d:
    if not(x*10**6+y in s):
      print(ma+mb)
      exit()
print(ma+mb-1) h,w,m=map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m a=[0]*h a [0]*h [0] 0 h b=[0]*w b [0]*w [0] 0 w s=set() s set() set for _ in range(m):
  x,y=map(lambda x:int(x)-1,input().split())
  a[x]+=1;b[y]+=1
  s.add(x*10**6+y) _ range(m) range m x,y=map(lambda x:int(x)-1,input().split()) x map(lambda x:int(x)-1,input().split()) map lambda x:int(x)-1 int(x)-1 int(x) int x 1 x input().split() ().split () input split y a[x]+=1 a[x] a x 1 b[y]+=1 b[y] b y 1 s.add(x*10**6+y) s.add s add x*10**6+y x*10**6 x 10**6 10 6 y ma=max(a) ma max(a) max a mb=max(b) mb max(b) max b i for i,v in enumerate(a) if v==ma for i,v in enumerate(a) if v==ma i v enumerate(a) enumerate a v==ma v ma if v==ma i c=[i for i,v in enumerate(a) if v==ma] c [i for i,v in enumerate(a) if v==ma] i for i,v in enumerate(b) if v==mb for i,v in enumerate(b) if v==mb i v enumerate(b) enumerate b v==mb v mb if v==mb i d=[i for i,v in enumerate(b) if v==mb] d [i for i,v in enumerate(b) if v==mb] for x in c:
  for y in d:
    if not(x*10**6+y in s):
      print(ma+mb)
      exit() x c for y in d:
    if not(x*10**6+y in s):
      print(ma+mb)
      exit() y d if not(x*10**6+y in s):
      print(ma+mb)
      exit() not(x*10**6+y in s) x*10**6+y in s x*10**6+y x*10**6 x 10**6 10 6 y s print(ma+mb) print ma+mb ma mb exit() exit print(ma+mb-1) print ma+mb-1 ma+mb ma mb 1 a=[0]*h [0]*h a w,m=map(int,input().split()) map(int,input().split()) w ma=max(a) max(a) ma mb=max(b) max(b) mb d=[i for i,v in enumerate(b) if v==mb] [i for i,v in enumerate(b) if v==mb] d y=map(lambda x:int(x)-1,input().split()) map(lambda x:int(x)-1,input().split()) y b=[0]*w [0]*w b h,w,m=map(int,input().split()) map(int,input().split()) h x,y=map(lambda x:int(x)-1,input().split()) map(lambda x:int(x)-1,input().split()) x c=[i for i,v in enumerate(a) if v==ma] [i for i,v in enumerate(a) if v==ma] c m=map(int,input().split()) map(int,input().split()) m s=set() set() s
h,w,m=map(int,input().split())
a=[0]*h;b=[0]*w
s=set()
for _ in range(m):
  x,y=map(lambda x:int(x)-1,input().split())
  a[x]+=1;b[y]+=1
  s.add(x*10**6+y)
ma=max(a);mb=max(b)
c=[i for i,v in enumerate(a) if v==ma]
d=[i for i,v in enumerate(b) if v==mb]
for x in c:
  for y in d:
    if not(x*10**6+y in s):
      print(ma+mb)
      exit()
print(ma+mb-1)