H, W, M = map(int,input().split())
P = [list(map(int, input().split())) for i in range(M)]
for p in P:
    p[0] -= 1
    p[1] -= 1
cnth = [0]*H
cntw = [0]*W
ans = 0
for p in P:
    cnth[p[0]] += 1
for p in P:
    cntw[p[1]] += 1
mxh = max(cnth)
mxw = max(cntw)
cntx = 0
for p in P:
    if cnth[p[0]] == mxh and cntw[p[1]] == mxw:
        cntx += 1
if cntx == cnth.count(mxh) * cntw.count(mxw):
    ans = mxh + mxw -1
else:
    ans = mxh + mxw
print(ans) 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 i in range(M) for i in range(M) i range(M) range M for i in range(M) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split P = [list(map(int, input().split())) for i in range(M)] P [list(map(int, input().split())) for i in range(M)] for p in P:
    p[0] -= 1
    p[1] -= 1 p P p[0] -= 1 p[0] p 0 1 p[1] -= 1 p[1] p 1 1 cnth = [0]*H cnth [0]*H [0] 0 H cntw = [0]*W cntw [0]*W [0] 0 W ans = 0 ans 0 for p in P:
    cnth[p[0]] += 1 p P cnth[p[0]] += 1 cnth[p[0]] cnth p[0] p 0 1 for p in P:
    cntw[p[1]] += 1 p P cntw[p[1]] += 1 cntw[p[1]] cntw p[1] p 1 1 mxh = max(cnth) mxh max(cnth) max cnth mxw = max(cntw) mxw max(cntw) max cntw cntx = 0 cntx 0 for p in P:
    if cnth[p[0]] == mxh and cntw[p[1]] == mxw:
        cntx += 1 p P if cnth[p[0]] == mxh and cntw[p[1]] == mxw:
        cntx += 1 cnth[p[0]] == mxh and cntw[p[1]] == mxw cnth[p[0]] == mxh cnth[p[0]] cnth p[0] p 0 mxh cntw[p[1]] == mxw cntw[p[1]] cntw p[1] p 1 mxw cntx += 1 cntx 1 if cntx == cnth.count(mxh) * cntw.count(mxw):
    ans = mxh + mxw -1
else:
    ans = mxh + mxw cntx == cnth.count(mxh) * cntw.count(mxw) cntx cnth.count(mxh) * cntw.count(mxw) cnth.count(mxh) cnth.count cnth count mxh cntw.count(mxw) cntw.count cntw count mxw ans = mxh + mxw -1 ans mxh + mxw -1 mxh + mxw mxh mxw 1 ans = mxh + mxw ans mxh + mxw mxh mxw print(ans) print ans H, W, M = map(int,input().split()) map(int,input().split()) H M = map(int,input().split()) map(int,input().split()) M mxw = max(cntw) max(cntw) mxw cnth = [0]*H [0]*H cnth cntx = 0 0 cntx ans = mxh + mxw mxh + mxw ans cntx += 1 1 cntx ans = mxh + mxw -1 mxh + mxw -1 ans W, M = map(int,input().split()) map(int,input().split()) W mxh = max(cnth) max(cnth) mxh P = [list(map(int, input().split())) for i in range(M)] [list(map(int, input().split())) for i in range(M)] P cntw = [0]*W [0]*W cntw ans = 0 0 ans
H, W, M = map(int,input().split())
P = [list(map(int, input().split())) for i in range(M)]
for p in P:
    p[0] -= 1
    p[1] -= 1
cnth = [0]*H
cntw = [0]*W
ans = 0
for p in P:
    cnth[p[0]] += 1
for p in P:
    cntw[p[1]] += 1
mxh = max(cnth)
mxw = max(cntw)
cntx = 0
for p in P:
    if cnth[p[0]] == mxh and cntw[p[1]] == mxw:
        cntx += 1
if cntx == cnth.count(mxh) * cntw.count(mxw):
    ans = mxh + mxw -1
else:
    ans = mxh + mxw
print(ans)