H,W,M=map(int,input().split())
bombh=[]
bombw=[]
bomb=[]
w=[0]*W
h=[0]*H
for i in range(M):
    hs,ws=map(int,input().split())
    w[ws-1]+=1
    h[hs-1]+=1
    bomb.append([hs-1,ws-1])
maxh=max(h)
maxw=max(w)
ans=maxh+maxw
count=0
for i in range(M):
    if ans==h[bomb[i][0]]+w[bomb[i][1]]:
        count+=1
a=h.count(maxh)*w.count(maxw)
if a==count:
    ans-=1
print(ans) H,W,M=map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M bombh=[] bombh [] bombw=[] bombw [] bomb=[] bomb [] w=[0]*W w [0]*W [0] 0 W h=[0]*H h [0]*H [0] 0 H for i in range(M):
    hs,ws=map(int,input().split())
    w[ws-1]+=1
    h[hs-1]+=1
    bomb.append([hs-1,ws-1]) i range(M) range M hs,ws=map(int,input().split()) hs map(int,input().split()) map int input().split() ().split () input split ws w[ws-1]+=1 w[ws-1] w ws-1 ws 1 1 h[hs-1]+=1 h[hs-1] h hs-1 hs 1 1 bomb.append([hs-1,ws-1]) bomb.append bomb append [hs-1,ws-1] hs-1 hs 1 ws-1 ws 1 maxh=max(h) maxh max(h) max h maxw=max(w) maxw max(w) max w ans=maxh+maxw ans maxh+maxw maxh maxw count=0 count 0 for i in range(M):
    if ans==h[bomb[i][0]]+w[bomb[i][1]]:
        count+=1 i range(M) range M if ans==h[bomb[i][0]]+w[bomb[i][1]]:
        count+=1 ans==h[bomb[i][0]]+w[bomb[i][1]] ans h[bomb[i][0]]+w[bomb[i][1]] h[bomb[i][0]] h bomb[i][0] [i] bomb i 0 w[bomb[i][1]] w bomb[i][1] [i] bomb i 1 count+=1 count 1 a=h.count(maxh)*w.count(maxw) a h.count(maxh)*w.count(maxw) h.count(maxh) h.count h count maxh w.count(maxw) w.count w count maxw if a==count:
    ans-=1 a==count a count ans-=1 ans 1 print(ans) print ans W,M=map(int,input().split()) map(int,input().split()) W ans-=1 1 ans bomb=[] [] bomb H,W,M=map(int,input().split()) map(int,input().split()) H a=h.count(maxh)*w.count(maxw) h.count(maxh)*w.count(maxw) a bombw=[] [] bombw maxw=max(w) max(w) maxw M=map(int,input().split()) map(int,input().split()) M ans=maxh+maxw maxh+maxw ans w=[0]*W [0]*W w count=0 0 count hs,ws=map(int,input().split()) map(int,input().split()) hs maxh=max(h) max(h) maxh h=[0]*H [0]*H h bombh=[] [] bombh ws=map(int,input().split()) map(int,input().split()) ws count+=1 1 count
H,W,M=map(int,input().split())
bombh=[]
bombw=[]
bomb=[]
w=[0]*W
h=[0]*H
for i in range(M):
    hs,ws=map(int,input().split())
    w[ws-1]+=1
    h[hs-1]+=1
    bomb.append([hs-1,ws-1])
maxh=max(h)
maxw=max(w)
ans=maxh+maxw
count=0
for i in range(M):
    if ans==h[bomb[i][0]]+w[bomb[i][1]]:
        count+=1
a=h.count(maxh)*w.count(maxw)
if a==count:
    ans-=1
print(ans)