h,w,n=map(int,input().split())
H=[0]*h
W=[0]*w
L=[(0,0)]*n
for i in range(n):
    a,b=map(int,input().split())
    L[i]=(a,b)
    H[a-1]+=1
    W[b-1]+=1
h_max=max(H)
w_max=max(W)
ans=h_max+w_max
cnt=0
for l in L:
    if H[l[0]-1]==h_max and W[l[1]-1]==w_max:
        cnt+=1
if H.count(h_max)*W.count(w_max)==cnt:
    ans-=1
print(ans) h,w,n=map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w n H=[0]*h H [0]*h [0] 0 h W=[0]*w W [0]*w [0] 0 w L=[(0,0)]*n L [(0,0)]*n [(0,0)] (0,0) 0 0 n for i in range(n):
    a,b=map(int,input().split())
    L[i]=(a,b)
    H[a-1]+=1
    W[b-1]+=1 i range(n) range n a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b L[i]=(a,b) L[i] L i (a,b) a b H[a-1]+=1 H[a-1] H a-1 a 1 1 W[b-1]+=1 W[b-1] W b-1 b 1 1 h_max=max(H) h_max max(H) max H w_max=max(W) w_max max(W) max W ans=h_max+w_max ans h_max+w_max h_max w_max cnt=0 cnt 0 for l in L:
    if H[l[0]-1]==h_max and W[l[1]-1]==w_max:
        cnt+=1 l L if H[l[0]-1]==h_max and W[l[1]-1]==w_max:
        cnt+=1 H[l[0]-1]==h_max and W[l[1]-1]==w_max H[l[0]-1]==h_max H[l[0]-1] H l[0]-1 l[0] l 0 1 h_max W[l[1]-1]==w_max W[l[1]-1] W l[1]-1 l[1] l 1 1 w_max cnt+=1 cnt 1 if H.count(h_max)*W.count(w_max)==cnt:
    ans-=1 H.count(h_max)*W.count(w_max)==cnt H.count(h_max)*W.count(w_max) H.count(h_max) H.count H count h_max W.count(w_max) W.count W count w_max cnt ans-=1 ans 1 print(ans) print ans a,b=map(int,input().split()) map(int,input().split()) a b=map(int,input().split()) map(int,input().split()) b n=map(int,input().split()) map(int,input().split()) n cnt=0 0 cnt cnt+=1 1 cnt w,n=map(int,input().split()) map(int,input().split()) w ans=h_max+w_max h_max+w_max ans w_max=max(W) max(W) w_max h_max=max(H) max(H) h_max H=[0]*h [0]*h H L=[(0,0)]*n [(0,0)]*n L ans-=1 1 ans h,w,n=map(int,input().split()) map(int,input().split()) h W=[0]*w [0]*w W
h,w,n=map(int,input().split())
H=[0]*h
W=[0]*w
L=[(0,0)]*n
for i in range(n):
    a,b=map(int,input().split())
    L[i]=(a,b)
    H[a-1]+=1
    W[b-1]+=1
h_max=max(H)
w_max=max(W)
ans=h_max+w_max
cnt=0
for l in L:
    if H[l[0]-1]==h_max and W[l[1]-1]==w_max:
        cnt+=1
if H.count(h_max)*W.count(w_max)==cnt:
    ans-=1
print(ans)