H, W, M = map(int, input().split())
boms = []
h, w = [0] * (H + 1), [0] * (W + 1)
for _ in range(M):
    h_, w_ = map(int, input().split())
    boms.append([h_, w_])
    h[h_] += 1
    w[w_] += 1

hmax = max(h)
wmax = max(w)

cnt = h.count(hmax) * w.count(wmax)
for hh, ww in boms:
    if hmax == h[hh] and wmax == w[ww]:
        cnt -= 1

print(hmax + wmax - (cnt == 0)) H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M boms = [] boms [] h, w = [0] * (H + 1), [0] * (W + 1) h [0] * (H + 1) [0] 0 H + 1 H 1 w [0] * (W + 1) [0] 0 W + 1 W 1 for _ in range(M):
    h_, w_ = map(int, input().split())
    boms.append([h_, w_])
    h[h_] += 1
    w[w_] += 1 _ range(M) range M h_, w_ = map(int, input().split()) h_ map(int, input().split()) map int input().split() ().split () input split w_ boms.append([h_, w_]) boms.append boms append [h_, w_] h_ w_ h[h_] += 1 h[h_] h h_ 1 w[w_] += 1 w[w_] w w_ 1 hmax = max(h) hmax max(h) max h wmax = max(w) wmax max(w) max w cnt = h.count(hmax) * w.count(wmax) cnt h.count(hmax) * w.count(wmax) h.count(hmax) h.count h count hmax w.count(wmax) w.count w count wmax for hh, ww in boms:
    if hmax == h[hh] and wmax == w[ww]:
        cnt -= 1 hh ww boms if hmax == h[hh] and wmax == w[ww]:
        cnt -= 1 hmax == h[hh] and wmax == w[ww] hmax == h[hh] hmax h[hh] h hh wmax == w[ww] wmax w[ww] w ww cnt -= 1 cnt 1 print(hmax + wmax - (cnt == 0)) print hmax + wmax - (cnt == 0) hmax + wmax hmax wmax cnt == 0 cnt 0 hmax = max(h) max(h) hmax M = map(int, input().split()) map(int, input().split()) M h, w = [0] * (H + 1), [0] * (W + 1) [0] * (H + 1) h wmax = max(w) max(w) wmax W, M = map(int, input().split()) map(int, input().split()) W H, W, M = map(int, input().split()) map(int, input().split()) H boms = [] [] boms w = [0] * (H + 1), [0] * (W + 1) [0] * (W + 1) w cnt -= 1 1 cnt w_ = map(int, input().split()) map(int, input().split()) w_ cnt = h.count(hmax) * w.count(wmax) h.count(hmax) * w.count(wmax) cnt h_, w_ = map(int, input().split()) map(int, input().split()) h_
H, W, M = map(int, input().split())
boms = []
h, w = [0] * (H + 1), [0] * (W + 1)
for _ in range(M):
    h_, w_ = map(int, input().split())
    boms.append([h_, w_])
    h[h_] += 1
    w[w_] += 1

hmax = max(h)
wmax = max(w)

cnt = h.count(hmax) * w.count(wmax)
for hh, ww in boms:
    if hmax == h[hh] and wmax == w[ww]:
        cnt -= 1

print(hmax + wmax - (cnt == 0))
