x, y, m = map(int,input().split())
mat = set()
r = [0]*x
c = [0]*y
smx = 0
smy = 0
for _ in range(m):
    p, q = map(int,input().split())
    p -= 1
    q -= 1
    mat.add((p,q))
    r[p] += 1
    c[q] += 1
    smx = max(smx,r[p])
    smy = max(smy,c[q])
xs = []
ys = []
for i in range(x):
    if smx == r[i]: xs.append(i)
for i in range(y):
    if smy == c[i]: ys.append(i)

ans = smx + smy - 1

for h in xs:
    for w in ys:
        if (h, w) in mat: continue
        print(ans + 1)
        exit()
print(ans) x, y, m = map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split y m mat = set() mat set() set r = [0]*x r [0]*x [0] 0 x c = [0]*y c [0]*y [0] 0 y smx = 0 smx 0 smy = 0 smy 0 for _ in range(m):
    p, q = map(int,input().split())
    p -= 1
    q -= 1
    mat.add((p,q))
    r[p] += 1
    c[q] += 1
    smx = max(smx,r[p])
    smy = max(smy,c[q]) _ range(m) range m p, q = map(int,input().split()) p map(int,input().split()) map int input().split() ().split () input split q p -= 1 p 1 q -= 1 q 1 mat.add((p,q)) mat.add mat add (p,q) p q r[p] += 1 r[p] r p 1 c[q] += 1 c[q] c q 1 smx = max(smx,r[p]) smx max(smx,r[p]) max smx r[p] r p smy = max(smy,c[q]) smy max(smy,c[q]) max smy c[q] c q xs = [] xs [] ys = [] ys [] for i in range(x):
    if smx == r[i]: xs.append(i) i range(x) range x if smx == r[i]: xs.appen smx == r[i] smx r[i] r i for i in range(y):
    if smy == c[i]: ys.append(i) i range(y) range y if smy == c[i]: ys.appen smy == c[i] smy c[i] c i ans = smx + smy - 1 ans smx + smy - 1 smx + smy smx smy 1 for h in xs:
    for w in ys:
        if (h, w) in mat: continue
        print(ans + 1)
        exit() h xs for w in ys:
        if (h, w) in mat: continue
        print(ans + 1)
        exit() w ys if (h, w) in mat: continue
         (h, w) in mat (h, w) h w mat print(ans + 1) print ans + 1 ans 1 exit() exit print(ans) print ans p, q = map(int,input().split()) map(int,input().split()) p xs = [] [] xs ans = smx + smy - 1 smx + smy - 1 ans smy = max(smy,c[q]) max(smy,c[q]) smy p -= 1 1 p ys = [] [] ys smx = 0 0 smx x, y, m = map(int,input().split()) map(int,input().split()) x mat = set() set() mat c = [0]*y [0]*y c m = map(int,input().split()) map(int,input().split()) m smx = max(smx,r[p]) max(smx,r[p]) smx y, m = map(int,input().split()) map(int,input().split()) y q -= 1 1 q r = [0]*x [0]*x r q = map(int,input().split()) map(int,input().split()) q smy = 0 0 smy
x, y, m = map(int,input().split())
mat = set()
r = [0]*x
c = [0]*y
smx = 0
smy = 0
for _ in range(m):
    p, q = map(int,input().split())
    p -= 1
    q -= 1
    mat.add((p,q))
    r[p] += 1
    c[q] += 1
    smx = max(smx,r[p])
    smy = max(smy,c[q])
xs = []
ys = []
for i in range(x):
    if smx == r[i]: xs.append(i)
for i in range(y):
    if smy == c[i]: ys.append(i)

ans = smx + smy - 1

for h in xs:
    for w in ys:
        if (h, w) in mat: continue
        print(ans + 1)
        exit()
print(ans)
