H, W, M = map(int,input().split())
Bomb = []
for _ in range(M):
    hi, wi = map(lambda x: int(x) - 1, input().split())
    Bomb.append((hi, wi))

counterH = [0] * H
counterW = [0] * W

for (hi, wi) in Bomb:
    counterH[hi] += 1
    counterW[wi] += 1

# 最大のところを選ぶ
max_h = max(counterH)
max_w = max(counterW)

count = 0
for (hi, wi) in Bomb:
    if counterH[hi] == max_h and counterW[wi] == max_w:
        count += 1

# 共通部分を確認 (-1)
ans = max_h + max_w
if count == counterH.count(max_h) * counterW.count(max_w):
    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 Bomb = [] Bomb [] for _ in range(M):
    hi, wi = map(lambda x: int(x) - 1, input().split())
    Bomb.append((hi, wi)) _ range(M) range M hi, wi = map(lambda x: int(x) - 1, input().split()) hi map(lambda x: int(x) - 1, input().split()) map lambda x: int(x) - 1 int(x) - 1 int(x) int x 1 x input().split() ().split () input split wi Bomb.append((hi, wi)) Bomb.append Bomb append (hi, wi) hi wi counterH = [0] * H counterH [0] * H [0] 0 H counterW = [0] * W counterW [0] * W [0] 0 W for (hi, wi) in Bomb:
    counterH[hi] += 1
    counterW[wi] += 1

# 最大のところを選ぶ (hi, wi) hi wi Bomb counterH[hi] += 1 counterH[hi] counterH hi 1 counterW[wi] += 1 counterW[wi] counterW wi 1 max_h = max(counterH) max_h max(counterH) max counterH max_w = max(counterW) max_w max(counterW) max counterW count = 0 count 0 for (hi, wi) in Bomb:
    if counterH[hi] == max_h and counterW[wi] == max_w:
        count += 1

# 共通部分を確認 (-1) (hi, wi) hi wi Bomb if counterH[hi] == max_h and counterW[wi] == max_w:
        count += 1

# 共通部分を確認 (-1) counterH[hi] == max_h and counterW[wi] == max_w counterH[hi] == max_h counterH[hi] counterH hi max_h counterW[wi] == max_w counterW[wi] counterW wi max_w count += 1 count 1 ans = max_h + max_w ans max_h + max_w max_h max_w if count == counterH.count(max_h) * counterW.count(max_w):
    ans -= 1 count == counterH.count(max_h) * counterW.count(max_w) count counterH.count(max_h) * counterW.count(max_w) counterH.count(max_h) counterH.count counterH count max_h counterW.count(max_w) counterW.count counterW count max_w ans -= 1 ans 1 print(ans) print ans count += 1 1 count W, M = map(int,input().split()) map(int,input().split()) W ans -= 1 1 ans counterH = [0] * H [0] * H counterH ans = max_h + max_w max_h + max_w ans max_w = max(counterW) max(counterW) max_w H, W, M = map(int,input().split()) map(int,input().split()) H Bomb = [] [] Bomb counterW = [0] * W [0] * W counterW M = map(int,input().split()) map(int,input().split()) M count = 0 0 count wi = map(lambda x: int(x) - 1, input().split()) map(lambda x: int(x) - 1, input().split()) wi max_h = max(counterH) max(counterH) max_h hi, wi = map(lambda x: int(x) - 1, input().split()) map(lambda x: int(x) - 1, input().split()) hi
H, W, M = map(int,input().split())
Bomb = []
for _ in range(M):
    hi, wi = map(lambda x: int(x) - 1, input().split())
    Bomb.append((hi, wi))

counterH = [0] * H
counterW = [0] * W

for (hi, wi) in Bomb:
    counterH[hi] += 1
    counterW[wi] += 1

# 最大のところを選ぶ
max_h = max(counterH)
max_w = max(counterW)

count = 0
for (hi, wi) in Bomb:
    if counterH[hi] == max_h and counterW[wi] == max_w:
        count += 1

# 共通部分を確認 (-1)
ans = max_h + max_w
if count == counterH.count(max_h) * counterW.count(max_w):
    ans -= 1
print(ans)
