import sys

H, W, M = map(int,input().split())
R = [0] * H
C = [0] * W

S = set()

for _ in range(M):
    h, w = map(int,input().split())
    S.add((h-1, w-1))
    R[h-1] += 1
    C[w-1] += 1

r = max(R)
c = max(C)

HL = [i for i in range(H) if R[i] == r]
WL = [i for i in range(W) if C[i] == c]

for h in HL:
    for w in WL:
        if not (h, w) in S:
            print(r + c)
            sys.exit()

print(r + c - 1) import sys sys H, W, M = map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M R = [0] * H R [0] * H [0] 0 H C = [0] * W C [0] * W [0] 0 W S = set() S set() set for _ in range(M):
    h, w = map(int,input().split())
    S.add((h-1, w-1))
    R[h-1] += 1
    C[w-1] += 1 _ range(M) range M h, w = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w S.add((h-1, w-1)) S.add S add (h-1, w-1) h-1 h 1 w-1 w 1 R[h-1] += 1 R[h-1] R h-1 h 1 1 C[w-1] += 1 C[w-1] C w-1 w 1 1 r = max(R) r max(R) max R c = max(C) c max(C) max C i for i in range(H) if R[i] == r for i in range(H) if R[i] == r i range(H) range H R[i] == r R[i] R i r if R[i] == r i HL = [i for i in range(H) if R[i] == r] HL [i for i in range(H) if R[i] == r] i for i in range(W) if C[i] == c for i in range(W) if C[i] == c i range(W) range W C[i] == c C[i] C i c if C[i] == c i WL = [i for i in range(W) if C[i] == c] WL [i for i in range(W) if C[i] == c] for h in HL:
    for w in WL:
        if not (h, w) in S:
            print(r + c)
            sys.exit() h HL for w in WL:
        if not (h, w) in S:
            print(r + c)
            sys.exit() w WL if not (h, w) in S:
            print(r + c)
            sys.exit() not (h, w) in S (h, w) in S (h, w) h w S print(r + c) print r + c r c sys.exit() sys.exit sys exit print(r + c - 1) print r + c - 1 r + c r c 1 c = max(C) max(C) c C = [0] * W [0] * W C H, W, M = map(int,input().split()) map(int,input().split()) H HL = [i for i in range(H) if R[i] == r] [i for i in range(H) if R[i] == r] HL r = max(R) max(R) r R = [0] * H [0] * H R w = map(int,input().split()) map(int,input().split()) w M = map(int,input().split()) map(int,input().split()) M S = set() set() S h, w = map(int,input().split()) map(int,input().split()) h WL = [i for i in range(W) if C[i] == c] [i for i in range(W) if C[i] == c] WL W, M = map(int,input().split()) map(int,input().split()) W
import sys

H, W, M = map(int,input().split())
R = [0] * H
C = [0] * W

S = set()

for _ in range(M):
    h, w = map(int,input().split())
    S.add((h-1, w-1))
    R[h-1] += 1
    C[w-1] += 1

r = max(R)
c = max(C)

HL = [i for i in range(H) if R[i] == r]
WL = [i for i in range(W) if C[i] == c]

for h in HL:
    for w in WL:
        if not (h, w) in S:
            print(r + c)
            sys.exit()

print(r + c - 1)