h,w,m=map(int,input().split())
HW=[list(map(int,input().split())) for _ in range(m)]

H,W=[0 for _ in range(h)],[0 for _ in range(w)]
for i,j in HW:
    i,j=i-1,j-1
    H[i] +=1
    W[j] +=1

max_h,max_w=max(H),max(W)
ans=max_h+max_w
cnt=H.count(max_h)*W.count(max_w)
for i,j in HW:
    if H[i-1]==max_h and W[j-1]==max_w:
        cnt -=1
print(ans if cnt!=0 else ans-1) h,w,m=map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m list(map(int,input().split())) for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split HW=[list(map(int,input().split())) for _ in range(m)] HW [list(map(int,input().split())) for _ in range(m)] 0 for _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) 0 H,W=[0 for _ in range(h)],[0 for _ in range(w)] H [0 for _ in range(h)] W [0 for _ in range(w)] for i,j in HW:
    i,j=i-1,j-1
    H[i] +=1
    W[j] +=1 i j HW i,j=i-1,j-1 i i-1 i 1 j j-1 j 1 H[i] +=1 H[i] H i 1 W[j] +=1 W[j] W j 1 max_h,max_w=max(H),max(W) max_h max(H) max H max_w max(W) max W ans=max_h+max_w ans max_h+max_w max_h max_w cnt=H.count(max_h)*W.count(max_w) cnt H.count(max_h)*W.count(max_w) H.count(max_h) H.count H count max_h W.count(max_w) W.count W count max_w for i,j in HW:
    if H[i-1]==max_h and W[j-1]==max_w:
        cnt -=1 i j HW if H[i-1]==max_h and W[j-1]==max_w:
        cnt -=1 H[i-1]==max_h and W[j-1]==max_w H[i-1]==max_h H[i-1] H i-1 i 1 max_h W[j-1]==max_w W[j-1] W j-1 j 1 max_w cnt -=1 cnt 1 print(ans if cnt!=0 else ans-1) print ans if cnt!=0 else ans-1 cnt!=0 cnt 0 ans ans-1 ans 1 W=[0 for _ in range(h)],[0 for _ in range(w)] [0 for _ in range(w)] W cnt=H.count(max_h)*W.count(max_w) H.count(max_h)*W.count(max_w) cnt m=map(int,input().split()) map(int,input().split()) m max_h,max_w=max(H),max(W) max(H) max_h HW=[list(map(int,input().split())) for _ in range(m)] [list(map(int,input().split())) for _ in range(m)] HW cnt -=1 1 cnt j=i-1,j-1 j-1 j ans=max_h+max_w max_h+max_w ans i,j=i-1,j-1 i-1 i w,m=map(int,input().split()) map(int,input().split()) w h,w,m=map(int,input().split()) map(int,input().split()) h H,W=[0 for _ in range(h)],[0 for _ in range(w)] [0 for _ in range(h)] H max_w=max(H),max(W) max(W) max_w
h,w,m=map(int,input().split())
HW=[list(map(int,input().split())) for _ in range(m)]

H,W=[0 for _ in range(h)],[0 for _ in range(w)]
for i,j in HW:
    i,j=i-1,j-1
    H[i] +=1
    W[j] +=1

max_h,max_w=max(H),max(W)
ans=max_h+max_w
cnt=H.count(max_h)*W.count(max_w)
for i,j in HW:
    if H[i-1]==max_h and W[j-1]==max_w:
        cnt -=1
print(ans if cnt!=0 else ans-1)