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

H,W=[0]*h,[0]*w
for i,j in HW:
    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]==max_h and W[j]==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(lambda x:int(x)-1,input().split())) for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) list(map(lambda x:int(x)-1,input().split())) list 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 HW=[list(map(lambda x:int(x)-1,input().split())) for _ in range(m)] HW [list(map(lambda x:int(x)-1,input().split())) for _ in range(m)] H,W=[0]*h,[0]*w H [0]*h [0] 0 h W [0]*w [0] 0 w for i,j in HW:
    H[i] +=1
    W[j] +=1 i j HW 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]==max_h and W[j]==max_w:
        cnt -=1 i j HW if H[i]==max_h and W[j]==max_w:
        cnt -=1 H[i]==max_h and W[j]==max_w H[i]==max_h H[i] H i max_h W[j]==max_w W[j] W j 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]*h,[0]*w [0]*w W max_h,max_w=max(H),max(W) max(H) max_h HW=[list(map(lambda x:int(x)-1,input().split())) for _ in range(m)] [list(map(lambda x:int(x)-1,input().split())) for _ in range(m)] HW H,W=[0]*h,[0]*w [0]*h H max_w=max(H),max(W) max(W) max_w w,m=map(int,input().split()) map(int,input().split()) w ans=max_h+max_w max_h+max_w ans cnt -=1 1 cnt h,w,m=map(int,input().split()) map(int,input().split()) h m=map(int,input().split()) map(int,input().split()) m cnt=H.count(max_h)*W.count(max_w) H.count(max_h)*W.count(max_w) cnt
h,w,m=map(int,input().split())
HW=[list(map(lambda x:int(x)-1,input().split())) for _ in range(m)]

H,W=[0]*h,[0]*w
for i,j in HW:
    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]==max_h and W[j]==max_w:
        cnt -=1
print(ans if cnt!=0 else ans-1)