H, W, M = map(int, input().split())

countW = [0]*(W+1)
countH = [0]*(H+1)
bomb = []
for i in range(M):
    h, w = map(int, input().split())
    bomb.append((h, w))
    countH[h] += 1
    countW[w] += 1

maxW = max(countW)
maxH = max(countH)
ans = maxW + maxH - 1
countMaxW = countW.count(maxW)
countMaxH = countH.count(maxH)

sumz = 0
for i in range(M):
    h, w = bomb[i]
    if countH[h] == maxH and countW[w] == maxW:
        sumz += 1

if countMaxW*countMaxH > sumz:
    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 countW = [0]*(W+1) countW [0]*(W+1) [0] 0 W+1 W 1 countH = [0]*(H+1) countH [0]*(H+1) [0] 0 H+1 H 1 bomb = [] bomb [] for i in range(M):
    h, w = map(int, input().split())
    bomb.append((h, w))
    countH[h] += 1
    countW[w] += 1 i range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w bomb.append((h, w)) bomb.append bomb append (h, w) h w countH[h] += 1 countH[h] countH h 1 countW[w] += 1 countW[w] countW w 1 maxW = max(countW) maxW max(countW) max countW maxH = max(countH) maxH max(countH) max countH ans = maxW + maxH - 1 ans maxW + maxH - 1 maxW + maxH maxW maxH 1 countMaxW = countW.count(maxW) countMaxW countW.count(maxW) countW.count countW count maxW countMaxH = countH.count(maxH) countMaxH countH.count(maxH) countH.count countH count maxH sumz = 0 sumz 0 for i in range(M):
    h, w = bomb[i]
    if countH[h] == maxH and countW[w] == maxW:
        sumz += 1 i range(M) range M h, w = bomb[i] h bomb[i] bomb i w if countH[h] == maxH and countW[w] == maxW:
        sumz += 1 countH[h] == maxH and countW[w] == maxW countH[h] == maxH countH[h] countH h maxH countW[w] == maxW countW[w] countW w maxW sumz += 1 sumz 1 if countMaxW*countMaxH > sumz:
    ans += 1 countMaxW*countMaxH > sumz countMaxW*countMaxH countMaxW countMaxH sumz ans += 1 ans 1 print(ans) print ans H, W, M = map(int, input().split()) map(int, input().split()) H w = map(int, input().split()) map(int, input().split()) w sumz = 0 0 sumz countMaxW = countW.count(maxW) countW.count(maxW) countMaxW M = map(int, input().split()) map(int, input().split()) M h, w = bomb[i] bomb[i] h ans = maxW + maxH - 1 maxW + maxH - 1 ans bomb = [] [] bomb w = bomb[i] bomb[i] w maxW = max(countW) max(countW) maxW sumz += 1 1 sumz countW = [0]*(W+1) [0]*(W+1) countW countMaxH = countH.count(maxH) countH.count(maxH) countMaxH maxH = max(countH) max(countH) maxH ans += 1 1 ans h, w = map(int, input().split()) map(int, input().split()) h W, M = map(int, input().split()) map(int, input().split()) W countH = [0]*(H+1) [0]*(H+1) countH
H, W, M = map(int, input().split())

countW = [0]*(W+1)
countH = [0]*(H+1)
bomb = []
for i in range(M):
    h, w = map(int, input().split())
    bomb.append((h, w))
    countH[h] += 1
    countW[w] += 1

maxW = max(countW)
maxH = max(countH)
ans = maxW + maxH - 1
countMaxW = countW.count(maxW)
countMaxH = countH.count(maxH)

sumz = 0
for i in range(M):
    h, w = bomb[i]
    if countH[h] == maxH and countW[w] == maxW:
        sumz += 1

if countMaxW*countMaxH > sumz:
    ans += 1
print(ans)
