H,W,M=map(int,input().split())
s=[list(map(int,input().split())) for _ in range(M)]
Tr=[0 for _ in range(H+1)]
Tc=[0 for _ in range(W+1)]
for i in range(M):
    Tr[s[i][0]]+=1
    Tc[s[i][1]]+=1
mr=max(Tr)
mc=max(Tc)
Mr=[0 for _ in range(H+1)]
Mc=[0 for _ in range(W+1)]
Nmr=0
Nmc=0
for i in range(len(Tr)):
    if Tr[i]==mr:
        Mr[i]=1
        Nmr+=1
for i in range(len(Tc)):
    if Tc[i]==mc:
        Mc[i]=1
        Nmc+=1
cnt=0
for i in range(M):
    if Mr[s[i][0]]==1 and Mc[s[i][1]]==1:
        cnt+=1
if cnt<Nmr*Nmc:
    print(mr+mc)
else:
    print(mr+mc-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 s=[list(map(int,input().split())) for _ in range(M)] s [list(map(int,input().split())) for _ in range(M)] 0 for _ in range(H+1) for _ in range(H+1) _ range(H+1) range H+1 H 1 for _ in range(H+1) 0 Tr=[0 for _ in range(H+1)] Tr [0 for _ in range(H+1)] 0 for _ in range(W+1) for _ in range(W+1) _ range(W+1) range W+1 W 1 for _ in range(W+1) 0 Tc=[0 for _ in range(W+1)] Tc [0 for _ in range(W+1)] for i in range(M):
    Tr[s[i][0]]+=1
    Tc[s[i][1]]+=1 i range(M) range M Tr[s[i][0]]+=1 Tr[s[i][0]] Tr s[i][0] [i] s i 0 1 Tc[s[i][1]]+=1 Tc[s[i][1]] Tc s[i][1] [i] s i 1 1 mr=max(Tr) mr max(Tr) max Tr mc=max(Tc) mc max(Tc) max Tc 0 for _ in range(H+1) for _ in range(H+1) _ range(H+1) range H+1 H 1 for _ in range(H+1) 0 Mr=[0 for _ in range(H+1)] Mr [0 for _ in range(H+1)] 0 for _ in range(W+1) for _ in range(W+1) _ range(W+1) range W+1 W 1 for _ in range(W+1) 0 Mc=[0 for _ in range(W+1)] Mc [0 for _ in range(W+1)] Nmr=0 Nmr 0 Nmc=0 Nmc 0 for i in range(len(Tr)):
    if Tr[i]==mr:
        Mr[i]=1
        Nmr+=1 i range(len(Tr)) range len(Tr) len Tr if Tr[i]==mr:
        Mr[i]=1
        Nmr+=1 Tr[i]==mr Tr[i] Tr i mr Mr[i]=1 Mr[i] Mr i 1 Nmr+=1 Nmr 1 for i in range(len(Tc)):
    if Tc[i]==mc:
        Mc[i]=1
        Nmc+=1 i range(len(Tc)) range len(Tc) len Tc if Tc[i]==mc:
        Mc[i]=1
        Nmc+=1 Tc[i]==mc Tc[i] Tc i mc Mc[i]=1 Mc[i] Mc i 1 Nmc+=1 Nmc 1 cnt=0 cnt 0 for i in range(M):
    if Mr[s[i][0]]==1 and Mc[s[i][1]]==1:
        cnt+=1 i range(M) range M if Mr[s[i][0]]==1 and Mc[s[i][1]]==1:
        cnt+=1 Mr[s[i][0]]==1 and Mc[s[i][1]]==1 Mr[s[i][0]]==1 Mr[s[i][0]] Mr s[i][0] [i] s i 0 1 Mc[s[i][1]]==1 Mc[s[i][1]] Mc s[i][1] [i] s i 1 1 cnt+=1 cnt 1 if cnt<Nmr*Nmc:
    print(mr+mc)
else:
    print(mr+mc-1) cnt<Nmr*Nmc cnt Nmr*Nmc Nmr Nmc print(mr+mc) print mr+mc mr mc print(mr+mc-1) print mr+mc-1 mr+mc mr mc 1 Nmr=0 0 Nmr Nmc=0 0 Nmc Tc=[0 for _ in range(W+1)] [0 for _ in range(W+1)] Tc Nmc+=1 1 Nmc Mc=[0 for _ in range(W+1)] [0 for _ in range(W+1)] Mc s=[list(map(int,input().split())) for _ in range(M)] [list(map(int,input().split())) for _ in range(M)] s Mr=[0 for _ in range(H+1)] [0 for _ in range(H+1)] Mr Tr=[0 for _ in range(H+1)] [0 for _ in range(H+1)] Tr Nmr+=1 1 Nmr mc=max(Tc) max(Tc) mc H,W,M=map(int,input().split()) map(int,input().split()) H M=map(int,input().split()) map(int,input().split()) M cnt+=1 1 cnt W,M=map(int,input().split()) map(int,input().split()) W cnt=0 0 cnt mr=max(Tr) max(Tr) mr
H,W,M=map(int,input().split())
s=[list(map(int,input().split())) for _ in range(M)]
Tr=[0 for _ in range(H+1)]
Tc=[0 for _ in range(W+1)]
for i in range(M):
    Tr[s[i][0]]+=1
    Tc[s[i][1]]+=1
mr=max(Tr)
mc=max(Tc)
Mr=[0 for _ in range(H+1)]
Mc=[0 for _ in range(W+1)]
Nmr=0
Nmc=0
for i in range(len(Tr)):
    if Tr[i]==mr:
        Mr[i]=1
        Nmr+=1
for i in range(len(Tc)):
    if Tc[i]==mc:
        Mc[i]=1
        Nmc+=1
cnt=0
for i in range(M):
    if Mr[s[i][0]]==1 and Mc[s[i][1]]==1:
        cnt+=1
if cnt<Nmr*Nmc:
    print(mr+mc)
else:
    print(mr+mc-1)