h,w,m=map(int,input().split())
A=[0]*h ; B=[0]*w ;G=[]
for i in range(m):
    x,y=map(int,input().split())
    A[x-1]+=1 ; B[y-1]+=1
    G.append([x-1,y-1])

q=max(A) ; e=max(B)
Q=[i for i in range(h) if A[i]==q] 
W=[j for j in range(w) if B[j]==e];#print(A,B,Q,W)
cnt=len(Q)*len(W)



for i in range(m):
    x,y=G[i]
    if A[x]==q and B[y]==e:
        cnt-=1
#print(grid)
if cnt==0:
    print(q+e-1)
else:
    print(q+e) 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 G=[] G [] for i in range(m):
    x,y=map(int,input().split())
    A[x-1]+=1 ; B[y-1]+=1
    G.append([x-1,y-1]) i range(m) range m x,y=map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split y A[x-1]+=1 A[x-1] A x-1 x 1 1 B[y-1]+=1 B[y-1] B y-1 y 1 1 G.append([x-1,y-1]) G.append G append [x-1,y-1] x-1 x 1 y-1 y 1 q=max(A) q max(A) max A e=max(B) e max(B) max B i for i in range(h) if A[i]==q for i in range(h) if A[i]==q i range(h) range h A[i]==q A[i] A i q if A[i]==q i Q=[i for i in range(h) if A[i]==q] Q [i for i in range(h) if A[i]==q] j for j in range(w) if B[j]==e for j in range(w) if B[j]==e j range(w) range w B[j]==e B[j] B j e if B[j]==e j W=[j for j in range(w) if B[j]==e] W [j for j in range(w) if B[j]==e] cnt=len(Q)*len(W) cnt len(Q)*len(W) len(Q) len Q len(W) len W for i in range(m):
    x,y=G[i]
    if A[x]==q and B[y]==e:
        cnt-=1
#print(grid) i range(m) range m x,y=G[i] x G[i] G i y if A[x]==q and B[y]==e:
        cnt-=1
#print(grid) A[x]==q and B[y]==e A[x]==q A[x] A x q B[y]==e B[y] B y e cnt-=1 cnt 1 if cnt==0:
    print(q+e-1)
else:
    print(q+e) cnt==0 cnt 0 print(q+e-1) print q+e-1 q+e q e 1 print(q+e) print q+e q e h,w,m=map(int,input().split()) map(int,input().split()) h e=max(B) max(B) e A=[0]*h [0]*h A w,m=map(int,input().split()) map(int,input().split()) w x,y=map(int,input().split()) map(int,input().split()) x y=map(int,input().split()) map(int,input().split()) y W=[j for j in range(w) if B[j]==e] [j for j in range(w) if B[j]==e] W G=[] [] G Q=[i for i in range(h) if A[i]==q] [i for i in range(h) if A[i]==q] Q cnt=len(Q)*len(W) len(Q)*len(W) cnt m=map(int,input().split()) map(int,input().split()) m x,y=G[i] G[i] x B=[0]*w [0]*w B q=max(A) max(A) q cnt-=1 1 cnt y=G[i] G[i] y
h,w,m=map(int,input().split())
A=[0]*h ; B=[0]*w ;G=[]
for i in range(m):
    x,y=map(int,input().split())
    A[x-1]+=1 ; B[y-1]+=1
    G.append([x-1,y-1])

q=max(A) ; e=max(B)
Q=[i for i in range(h) if A[i]==q] 
W=[j for j in range(w) if B[j]==e];#print(A,B,Q,W)
cnt=len(Q)*len(W)



for i in range(m):
    x,y=G[i]
    if A[x]==q and B[y]==e:
        cnt-=1
#print(grid)
if cnt==0:
    print(q+e-1)
else:
    print(q+e)
