h, w, m = map(int, input().split())
s = []
r = [0] * (h + 1)
c = [0] * (w + 1)
for i in range(m):
    bh, bw = map(int, input().split())
    s.append([bh, bw])
    r[bh] += 1
    c[bw] += 1
R = max(r)
nr = {i for i, x in enumerate(r) if x == R}
C = max(c)
nc = {i for i, x in enumerate(c) if x == C}
count = sum(x in nr and y in nc for x, y in s)
print(R + C - (len(nr) * len(nc) == count)) h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m s = [] s [] r = [0] * (h + 1) r [0] * (h + 1) [0] 0 h + 1 h 1 c = [0] * (w + 1) c [0] * (w + 1) [0] 0 w + 1 w 1 for i in range(m):
    bh, bw = map(int, input().split())
    s.append([bh, bw])
    r[bh] += 1
    c[bw] += 1 i range(m) range m bh, bw = map(int, input().split()) bh map(int, input().split()) map int input().split() ().split () input split bw s.append([bh, bw]) s.append s append [bh, bw] bh bw r[bh] += 1 r[bh] r bh 1 c[bw] += 1 c[bw] c bw 1 R = max(r) R max(r) max r i for i, x in enumerate(r) if x == R for i, x in enumerate(r) if x == R i x enumerate(r) enumerate r x == R x R if x == R i nr = {i for i, x in enumerate(r) if x == R} nr C = max(c) C max(c) max c i for i, x in enumerate(c) if x == C for i, x in enumerate(c) if x == C i x enumerate(c) enumerate c x == C x C if x == C i nc = {i for i, x in enumerate(c) if x == C} nc count = sum(x in nr and y in nc for x, y in s) count sum(x in nr and y in nc for x, y in s) sum x in nr and y in nc x in nr x nr y in nc y nc print(R + C - (len(nr) * len(nc) == count)) print R + C - (len(nr) * len(nc) == count) R + C R C len(nr) * len(nc) == count len(nr) * len(nc) len(nr) len nr len(nc) len nc count r = [0] * (h + 1) [0] * (h + 1) r m = map(int, input().split()) map(int, input().split()) m nc = {i for i, x in enumerate(c) if x == C} nc R = max(r) max(r) R nr = {i for i, x in enumerate(r) if x == R} nr bw = map(int, input().split()) map(int, input().split()) bw C = max(c) max(c) C s = [] [] s bh, bw = map(int, input().split()) map(int, input().split()) bh count = sum(x in nr and y in nc for x, y in s) sum(x in nr and y in nc for x, y in s) count c = [0] * (w + 1) [0] * (w + 1) c w, m = map(int, input().split()) map(int, input().split()) w h, w, m = map(int, input().split()) map(int, input().split()) h
h, w, m = map(int, input().split())
s = []
r = [0] * (h + 1)
c = [0] * (w + 1)
for i in range(m):
    bh, bw = map(int, input().split())
    s.append([bh, bw])
    r[bh] += 1
    c[bw] += 1
R = max(r)
nr = {i for i, x in enumerate(r) if x == R}
C = max(c)
nc = {i for i, x in enumerate(c) if x == C}
count = sum(x in nr and y in nc for x, y in s)
print(R + C - (len(nr) * len(nc) == count))