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

L = []

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

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

print(r + c - (R.count(r) * C.count(c) == sum(R[h] + C[w] == r + c for h, w in L))) 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 L = [] L [] for _ in range(M):
    h, w = map(int,input().split())
    R[h-1] += 1
    C[w-1] += 1
    L.append([h-1, 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 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 L.append([h-1, w-1]) L.append L append [h-1, w-1] h-1 h 1 w-1 w 1 r = max(R) r max(R) max R c = max(C) c max(C) max C print(r + c - (R.count(r) * C.count(c) == sum(R[h] + C[w] == r + c for h, w in L))) print r + c - (R.count(r) * C.count(c) == sum(R[h] + C[w] == r + c for h, w in L)) r + c r c R.count(r) * C.count(c) == sum(R[h] + C[w] == r + c for h, w in L) R.count(r) * C.count(c) R.count(r) R.count R count r C.count(c) C.count C count c sum(R[h] + C[w] == r + c for h, w in L) sum R[h] + C[w] == r + c R[h] + C[w] R[h] R h C[w] C w r + c r c H, W, M = map(int,input().split()) map(int,input().split()) H w = map(int,input().split()) map(int,input().split()) w h, w = map(int,input().split()) map(int,input().split()) h L = [] [] L r = max(R) max(R) r M = map(int,input().split()) map(int,input().split()) M C = [0] * W [0] * W C W, M = map(int,input().split()) map(int,input().split()) W R = [0] * H [0] * H R c = max(C) max(C) c
H, W, M = map(int,input().split())
R = [0] * H
C = [0] * W

L = []

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

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

print(r + c - (R.count(r) * C.count(c) == sum(R[h] + C[w] == r + c for h, w in L)))