import pprint
H, W, M = map(int, input().split())
bombs = set()
hCount = [0]*H
vCount = [0]*W

for i in range(M):
    h, w = map(int, input().split())
    h -= 1; w -= 1;
    hCount[h] += 1
    vCount[w] += 1
    bombs.add((h, w))

hMax = max(hCount)
vMax = max(vCount)
hMaxIndex = [i for i, x in enumerate(hCount) if x==hMax]
vMaxIndex = [i for i, x in enumerate(vCount) if x==vMax]

ans = -1
for x in vMaxIndex:
    for y in hMaxIndex:
        if (y, x) in bombs:
            continue
        else:
            print(hMax + vMax)
            exit()
print(hMax + vMax - 1) import pprint pprint H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M bombs = set() bombs set() set hCount = [0]*H hCount [0]*H [0] 0 H vCount = [0]*W vCount [0]*W [0] 0 W for i in range(M):
    h, w = map(int, input().split())
    h -= 1; w -= 1;
    hCount[h] += 1
    vCount[w] += 1
    bombs.add((h, w)) i range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w h -= 1 h 1 w -= 1 w 1 hCount[h] += 1 hCount[h] hCount h 1 vCount[w] += 1 vCount[w] vCount w 1 bombs.add((h, w)) bombs.add bombs add (h, w) h w hMax = max(hCount) hMax max(hCount) max hCount vMax = max(vCount) vMax max(vCount) max vCount i for i, x in enumerate(hCount) if x==hMax for i, x in enumerate(hCount) if x==hMax i x enumerate(hCount) enumerate hCount x==hMax x hMax if x==hMax i hMaxIndex = [i for i, x in enumerate(hCount) if x==hMax] hMaxIndex [i for i, x in enumerate(hCount) if x==hMax] i for i, x in enumerate(vCount) if x==vMax for i, x in enumerate(vCount) if x==vMax i x enumerate(vCount) enumerate vCount x==vMax x vMax if x==vMax i vMaxIndex = [i for i, x in enumerate(vCount) if x==vMax] vMaxIndex [i for i, x in enumerate(vCount) if x==vMax] ans = -1 ans -1 for x in vMaxIndex:
    for y in hMaxIndex:
        if (y, x) in bombs:
            continue
        else:
            print(hMax + vMax)
            exit() x vMaxIndex for y in hMaxIndex:
        if (y, x) in bombs:
            continue
        else:
            print(hMax + vMax)
            exit() y hMaxIndex if (y, x) in bombs:
            continue
        else:
            print(hMax + vMax)
            exit() (y, x) in bombs (y, x) y x bombs continue print(hMax + vMax) print hMax + vMax hMax vMax exit() exit print(hMax + vMax - 1) print hMax + vMax - 1 hMax + vMax hMax vMax 1 h, w = map(int, input().split()) map(int, input().split()) h ans = -1 -1 ans W, M = map(int, input().split()) map(int, input().split()) W w = map(int, input().split()) map(int, input().split()) w vCount = [0]*W [0]*W vCount w -= 1 1 w hCount = [0]*H [0]*H hCount hMaxIndex = [i for i, x in enumerate(hCount) if x==hMax] [i for i, x in enumerate(hCount) if x==hMax] hMaxIndex vMax = max(vCount) max(vCount) vMax bombs = set() set() bombs H, W, M = map(int, input().split()) map(int, input().split()) H h -= 1 1 h vMaxIndex = [i for i, x in enumerate(vCount) if x==vMax] [i for i, x in enumerate(vCount) if x==vMax] vMaxIndex hMax = max(hCount) max(hCount) hMax M = map(int, input().split()) map(int, input().split()) M
import pprint
H, W, M = map(int, input().split())
bombs = set()
hCount = [0]*H
vCount = [0]*W

for i in range(M):
    h, w = map(int, input().split())
    h -= 1; w -= 1;
    hCount[h] += 1
    vCount[w] += 1
    bombs.add((h, w))

hMax = max(hCount)
vMax = max(vCount)
hMaxIndex = [i for i, x in enumerate(hCount) if x==hMax]
vMaxIndex = [i for i, x in enumerate(vCount) if x==vMax]

ans = -1
for x in vMaxIndex:
    for y in hMaxIndex:
        if (y, x) in bombs:
            continue
        else:
            print(hMax + vMax)
            exit()
print(hMax + vMax - 1)
