H,W,M = map(int,input().split())
hs = [0]*H
ws = [0]*W
s = set()
for i in range(M):
    h,w = map(int,input().split())
    hs[h-1] += 1
    ws[w-1] += 1
    s.add((h-1,w-1))

mh = 0; mw = 0
for i in range(H):
    mh = max(mh,hs[i])
for i in range(W):
    mw = max(mw,ws[i])

Is = []; Js = []
for i in range(H):
    if mh ==  hs[i]:
        Is.append(i)
for i in range(W):
    if mw == ws[i]:
        Js.append(i)
ans = mh + mw
flag = 0
for i in Is:
    for j in Js:
        if (i,j) in s:
            continue
        print(ans)
        exit()
print(ans-1) H,W,M = map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M hs = [0]*H hs [0]*H [0] 0 H ws = [0]*W ws [0]*W [0] 0 W s = set() s set() set for i in range(M):
    h,w = map(int,input().split())
    hs[h-1] += 1
    ws[w-1] += 1
    s.add((h-1,w-1)) i range(M) range M h,w = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w hs[h-1] += 1 hs[h-1] hs h-1 h 1 1 ws[w-1] += 1 ws[w-1] ws w-1 w 1 1 s.add((h-1,w-1)) s.add s add (h-1,w-1) h-1 h 1 w-1 w 1 mh = 0 mh 0 mw = 0 mw 0 for i in range(H):
    mh = max(mh,hs[i]) i range(H) range H mh = max(mh,hs[i]) mh max(mh,hs[i]) max mh hs[i] hs i for i in range(W):
    mw = max(mw,ws[i]) i range(W) range W mw = max(mw,ws[i]) mw max(mw,ws[i]) max mw ws[i] ws i Is = [] Is [] Js = [] Js [] for i in range(H):
    if mh ==  hs[i]:
        Is.append(i) i range(H) range H if mh ==  hs[i]:
        Is.append(i) mh ==  hs[i] mh hs[i] hs i Is.append(i) Is.append Is append i for i in range(W):
    if mw == ws[i]:
        Js.append(i) i range(W) range W if mw == ws[i]:
        Js.append(i) mw == ws[i] mw ws[i] ws i Js.append(i) Js.append Js append i ans = mh + mw ans mh + mw mh mw flag = 0 flag 0 for i in Is:
    for j in Js:
        if (i,j) in s:
            continue
        print(ans)
        exit() i Is for j in Js:
        if (i,j) in s:
            continue
        print(ans)
        exit() j Js if (i,j) in s:
            continue
         (i,j) in s (i,j) i j s continue print(ans) print ans exit() exit print(ans-1) print ans-1 ans 1 h,w = map(int,input().split()) map(int,input().split()) h mh = 0 0 mh hs = [0]*H [0]*H hs mw = 0 0 mw ans = mh + mw mh + mw ans w = map(int,input().split()) map(int,input().split()) w ws = [0]*W [0]*W ws s = set() set() s Is = [] [] Is mh = max(mh,hs[i]) max(mh,hs[i]) mh Js = [] [] Js H,W,M = map(int,input().split()) map(int,input().split()) H M = map(int,input().split()) map(int,input().split()) M mw = max(mw,ws[i]) max(mw,ws[i]) mw W,M = map(int,input().split()) map(int,input().split()) W flag = 0 0 flag
H,W,M = map(int,input().split())
hs = [0]*H
ws = [0]*W
s = set()
for i in range(M):
    h,w = map(int,input().split())
    hs[h-1] += 1
    ws[w-1] += 1
    s.add((h-1,w-1))

mh = 0; mw = 0
for i in range(H):
    mh = max(mh,hs[i])
for i in range(W):
    mw = max(mw,ws[i])

Is = []; Js = []
for i in range(H):
    if mh ==  hs[i]:
        Is.append(i)
for i in range(W):
    if mw == ws[i]:
        Js.append(i)
ans = mh + mw
flag = 0
for i in Is:
    for j in Js:
        if (i,j) in s:
            continue
        print(ans)
        exit()
print(ans-1)