h,w,m = map(int,input().split())
hw = [list(map(int,input().split())) for _ in range(m)]
hlist = [0]*(h+1)
wlist = [0]*(w+1)
for x,y in hw:
    hlist[x]+=1
    wlist[y]+=1
hmax=max(hlist)
h_index = {n for n, v in enumerate(hlist) if v == hmax}
wmax=max(wlist)
w_index = {n for n, v in enumerate(wlist) if v == wmax}
count = sum(x in h_index and y in w_index for x,y in hw)
print(hmax+wmax-(len(h_index)*len(w_index)==count)) 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)] hlist = [0]*(h+1) hlist [0]*(h+1) [0] 0 h+1 h 1 wlist = [0]*(w+1) wlist [0]*(w+1) [0] 0 w+1 w 1 for x,y in hw:
    hlist[x]+=1
    wlist[y]+=1 x y hw hlist[x]+=1 hlist[x] hlist x 1 wlist[y]+=1 wlist[y] wlist y 1 hmax=max(hlist) hmax max(hlist) max hlist n for n, v in enumerate(hlist) if v == hmax for n, v in enumerate(hlist) if v == hmax n v enumerate(hlist) enumerate hlist v == hmax v hmax if v == hmax n h_index = {n for n, v in enumerate(hlist) if v == hmax} h_index wmax=max(wlist) wmax max(wlist) max wlist n for n, v in enumerate(wlist) if v == wmax for n, v in enumerate(wlist) if v == wmax n v enumerate(wlist) enumerate wlist v == wmax v wmax if v == wmax n w_index = {n for n, v in enumerate(wlist) if v == wmax} w_index count = sum(x in h_index and y in w_index for x,y in hw) count sum(x in h_index and y in w_index for x,y in hw) sum x in h_index and y in w_index x in h_index x h_index y in w_index y w_index print(hmax+wmax-(len(h_index)*len(w_index)==count)) print hmax+wmax-(len(h_index)*len(w_index)==count) hmax+wmax hmax wmax len(h_index)*len(w_index)==count len(h_index)*len(w_index) len(h_index) len h_index len(w_index) len w_index count wlist = [0]*(w+1) [0]*(w+1) wlist w,m = map(int,input().split()) map(int,input().split()) w hmax=max(hlist) max(hlist) hmax w_index = {n for n, v in enumerate(wlist) if v == wmax} w_index h,w,m = map(int,input().split()) map(int,input().split()) h count = sum(x in h_index and y in w_index for x,y in hw) sum(x in h_index and y in w_index for x,y in hw) count hw = [list(map(int,input().split())) for _ in range(m)] [list(map(int,input().split())) for _ in range(m)] hw h_index = {n for n, v in enumerate(hlist) if v == hmax} h_index m = map(int,input().split()) map(int,input().split()) m hlist = [0]*(h+1) [0]*(h+1) hlist wmax=max(wlist) max(wlist) wmax
h,w,m = map(int,input().split())
hw = [list(map(int,input().split())) for _ in range(m)]
hlist = [0]*(h+1)
wlist = [0]*(w+1)
for x,y in hw:
    hlist[x]+=1
    wlist[y]+=1
hmax=max(hlist)
h_index = {n for n, v in enumerate(hlist) if v == hmax}
wmax=max(wlist)
w_index = {n for n, v in enumerate(wlist) if v == wmax}
count = sum(x in h_index and y in w_index for x,y in hw)
print(hmax+wmax-(len(h_index)*len(w_index)==count))
