H,W,M = map(int, input().split())
L = [[int(l) for l in input().split()] for _ in range(M)]

hlist = [0]*(H+1)
wlist = [0]*(W+1)
for l in L:
    hlist[l[0]] += 1
    wlist[l[1]] += 1

hmax = max(hlist)
wmax = max(wlist)
h = hlist.count(hmax)
w = wlist.count(wmax)
ans = hmax+wmax-1
cnt = 0
for l in L:
    if hlist[l[0]] == hmax and wlist[l[1]] == wmax:
        cnt += 1

if cnt < h*w:
    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 [int(l) for l in input().split()] for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) [int(l) for l in input().split()] L = [[int(l) for l in input().split()] for _ in range(M)] L [[int(l) for l in 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 l in L:
    hlist[l[0]] += 1
    wlist[l[1]] += 1 l L hlist[l[0]] += 1 hlist[l[0]] hlist l[0] l 0 1 wlist[l[1]] += 1 wlist[l[1]] wlist l[1] l 1 1 hmax = max(hlist) hmax max(hlist) max hlist wmax = max(wlist) wmax max(wlist) max wlist h = hlist.count(hmax) h hlist.count(hmax) hlist.count hlist count hmax w = wlist.count(wmax) w wlist.count(wmax) wlist.count wlist count wmax ans = hmax+wmax-1 ans hmax+wmax-1 hmax+wmax hmax wmax 1 cnt = 0 cnt 0 for l in L:
    if hlist[l[0]] == hmax and wlist[l[1]] == wmax:
        cnt += 1 l L if hlist[l[0]] == hmax and wlist[l[1]] == wmax:
        cnt += 1 hlist[l[0]] == hmax and wlist[l[1]] == wmax hlist[l[0]] == hmax hlist[l[0]] hlist l[0] l 0 hmax wlist[l[1]] == wmax wlist[l[1]] wlist l[1] l 1 wmax cnt += 1 cnt 1 if cnt < h*w:
    ans += 1 cnt < h*w cnt h*w h w ans += 1 ans 1 print(ans) print ans cnt += 1 1 cnt hlist = [0]*(H+1) [0]*(H+1) hlist W,M = map(int, input().split()) map(int, input().split()) W H,W,M = map(int, input().split()) map(int, input().split()) H ans = hmax+wmax-1 hmax+wmax-1 ans w = wlist.count(wmax) wlist.count(wmax) w L = [[int(l) for l in input().split()] for _ in range(M)] [[int(l) for l in input().split()] for _ in range(M)] L ans += 1 1 ans h = hlist.count(hmax) hlist.count(hmax) h cnt = 0 0 cnt M = map(int, input().split()) map(int, input().split()) M wlist = [0]*(W+1) [0]*(W+1) wlist hmax = max(hlist) max(hlist) hmax wmax = max(wlist) max(wlist) wmax
H,W,M = map(int, input().split())
L = [[int(l) for l in input().split()] for _ in range(M)]

hlist = [0]*(H+1)
wlist = [0]*(W+1)
for l in L:
    hlist[l[0]] += 1
    wlist[l[1]] += 1

hmax = max(hlist)
wmax = max(wlist)
h = hlist.count(hmax)
w = wlist.count(wmax)
ans = hmax+wmax-1
cnt = 0
for l in L:
    if hlist[l[0]] == hmax and wlist[l[1]] == wmax:
        cnt += 1

if cnt < h*w:
    ans += 1
print(ans)