def solve(H, W, M, h, w):
    f = [0] * (H+1)
    g = [0] * (W+1)
    for r, c in zip(h, w):
        f[r] += 1
        g[c] += 1
    p = max(f)
    q = max(g)
    num = len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g)))
    num -= len(list(filter(lambda _: f[_[0]] + g[_[1]] == p + q, zip(h, w))))
    return p + q - (num <= 0)

H, W, M = map(int, input().split())
h, w = zip(*[map(int, input().split()) for i in range(M)])
print(solve(H, W, M, h, w)) def solve(H, W, M, h, w):
    f = [0] * (H+1)
    g = [0] * (W+1)
    for r, c in zip(h, w):
        f[r] += 1
        g[c] += 1
    p = max(f)
    q = max(g)
    num = len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g)))
    num -= len(list(filter(lambda _: f[_[0]] + g[_[1]] == p + q, zip(h, w))))
    return p + q - (num <= 0) solve f = [0] * (H+1) f [0] * (H+1) [0] 0 H+1 H 1 g = [0] * (W+1) g [0] * (W+1) [0] 0 W+1 W 1 for r, c in zip(h, w):
        f[r] += 1
        g[c] += 1
     r c zip(h, w) zip h w f[r] += 1 f[r] f r 1 g[c] += 1 g[c] g c 1 p = max(f) p max(f) max f q = max(g) q max(g) max g num = len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g))) num len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g))) len(list(filter(p.__eq__, f))) len list(filter(p.__eq__, f)) list filter(p.__eq__, f) filter p.__eq__ p __eq__ f len(list(filter(q.__eq__, g))) len list(filter(q.__eq__, g)) list filter(q.__eq__, g) filter q.__eq__ q __eq__ g num -= len(list(filter(lambda _: f[_[0]] + g[_[1]] == p + q, zip(h, w)))) num len(list(filter(lambda _: f[_[0]] + g[_[1]] == p + q, zip(h, w)))) len list(filter(lambda _: f[_[0]] + g[_[1]] == p + q, zip(h, w))) list filter(lambda _: f[_[0]] + g[_[1]] == p + q, zip(h, w)) filter lambda _: f[_[0]] + g[_[1]] == p + q f[_[0]] + g[_[1]] == p + q f[_[0]] + g[_[1]] f[_[0]] f _[0] _ 0 g[_[1]] g _[1] _ 1 p + q p q _ zip(h, w) zip h w return p + q - (num <= 0) p + q - (num <= 0) p + q p q num <= 0 num 0 H H W W M M h h w w H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M map(int, input().split()) for i in range(M) for i in range(M) i range(M) range M for i in range(M) map(int, input().split()) map int input().split() ().split () input split h, w = zip(*[map(int, input().split()) for i in range(M)]) h zip(*[map(int, input().split()) for i in range(M)]) zip *[map(int, input().split()) for i in range(M)] [map(int, input().split()) for i in range(M)] w print(solve(H, W, M, h, w)) print solve(H, W, M, h, w) solve H W M h w M = map(int, input().split()) map(int, input().split()) M def solve(H, W, M, h, w):
    f = [0] * (H+1)
    g = [0] * (W+1)
    for r, c in zip(h, w):
        f[r] += 1
        g[c] += 1
    p = max(f)
    q = max(g)
    num = len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g)))
    num -= len(list(filter(lambda _: f[_[0]] + g[_[1]] == p + q, zip(h, w))))
    return p + q - (num <= 0) def solve(H, W, M, h, w):
    f = [0] * (H+1)
    g = [0] * (W+1)
    for r, c in zip(h, w):
        f[r] += 1
        g[c] += 1
    p = max(f)
    q = max(g)
    num = len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g)))
    num -= len(list(filter(lambda _: f[_[0]] + g[_[1]] == p + q, zip(h, w))))
    return p + q - (num <= 0) solve W, M = map(int, input().split()) map(int, input().split()) W w = zip(*[map(int, input().split()) for i in range(M)]) zip(*[map(int, input().split()) for i in range(M)]) w h, w = zip(*[map(int, input().split()) for i in range(M)]) zip(*[map(int, input().split()) for i in range(M)]) h H, W, M = map(int, input().split()) map(int, input().split()) H
def solve(H, W, M, h, w):
    f = [0] * (H+1)
    g = [0] * (W+1)
    for r, c in zip(h, w):
        f[r] += 1
        g[c] += 1
    p = max(f)
    q = max(g)
    num = len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g)))
    num -= len(list(filter(lambda _: f[_[0]] + g[_[1]] == p + q, zip(h, w))))
    return p + q - (num <= 0)

H, W, M = map(int, input().split())
h, w = zip(*[map(int, input().split()) for i in range(M)])
print(solve(H, W, M, h, w))