H, W, M = map(int, input().split())
R = [0] * H
C = [0] * W
B = []
for i in range(M):
    hi, wi = map(lambda s: int(s) - 1, input().split())
    R[hi] += 1
    C[wi] += 1
    B.append((hi, wi))

Rmax = max(R)
Cmax = max(C)
ans = Rmax + Cmax
if R.count(Rmax) * C.count(Cmax) == sum([R[hi] == Rmax and C[wi] == Cmax for hi, wi in B]):
    ans -= 1

print(ans) 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 B = [] B [] for i in range(M):
    hi, wi = map(lambda s: int(s) - 1, input().split())
    R[hi] += 1
    C[wi] += 1
    B.append((hi, wi)) i range(M) range M hi, wi = map(lambda s: int(s) - 1, input().split()) hi map(lambda s: int(s) - 1, input().split()) map lambda s: int(s) - 1 int(s) - 1 int(s) int s 1 s input().split() ().split () input split wi R[hi] += 1 R[hi] R hi 1 C[wi] += 1 C[wi] C wi 1 B.append((hi, wi)) B.append B append (hi, wi) hi wi Rmax = max(R) Rmax max(R) max R Cmax = max(C) Cmax max(C) max C ans = Rmax + Cmax ans Rmax + Cmax Rmax Cmax if R.count(Rmax) * C.count(Cmax) == sum([R[hi] == Rmax and C[wi] == Cmax for hi, wi in B]):
    ans -= 1 R.count(Rmax) * C.count(Cmax) == sum([R[hi] == Rmax and C[wi] == Cmax for hi, wi in B]) R.count(Rmax) * C.count(Cmax) R.count(Rmax) R.count R count Rmax C.count(Cmax) C.count C count Cmax sum([R[hi] == Rmax and C[wi] == Cmax for hi, wi in B]) sum [R[hi] == Rmax and C[wi] == Cmax for hi, wi in B] ans -= 1 ans 1 print(ans) print ans ans = Rmax + Cmax Rmax + Cmax ans H, W, M = map(int, input().split()) map(int, input().split()) H wi = map(lambda s: int(s) - 1, input().split()) map(lambda s: int(s) - 1, input().split()) wi C = [0] * W [0] * W C B = [] [] B hi, wi = map(lambda s: int(s) - 1, input().split()) map(lambda s: int(s) - 1, input().split()) hi Rmax = max(R) max(R) Rmax ans -= 1 1 ans M = map(int, input().split()) map(int, input().split()) M Cmax = max(C) max(C) Cmax W, M = map(int, input().split()) map(int, input().split()) W R = [0] * H [0] * H R
H, W, M = map(int, input().split())
R = [0] * H
C = [0] * W
B = []
for i in range(M):
    hi, wi = map(lambda s: int(s) - 1, input().split())
    R[hi] += 1
    C[wi] += 1
    B.append((hi, wi))

Rmax = max(R)
Cmax = max(C)
ans = Rmax + Cmax
if R.count(Rmax) * C.count(Cmax) == sum([R[hi] == Rmax and C[wi] == Cmax for hi, wi in B]):
    ans -= 1

print(ans)
