H,W,M = map(int, input().split())
# grid = [[0 for _ in range(W)] for _ in range(H)]
bombs = set()

hc = [0 for h in range(H)]
wc = [0 for w in range(W)]

for _ in range(M):
    h,w = map(int, input().split())
    h-=1
    w-=1
    bombs.add((h, w))
    hc[h] += 1
    wc[w] += 1

hmax = max(hc)
wmax = max(wc)

htable = []
for h in range(H):
    if hc[h] == hmax:
        htable.append(h)

wtable = []
for w in range(W):
    if wc[w] == wmax:
        wtable.append(w)

# print(uw, uh)
#print(grid)
#print(wc, uw)
#print(hc, uh)

found = False
for h in htable:
    for w in wtable:
        if (h,w) not in bombs:
            print(hmax + wmax)
            exit(0)

print(hmax + wmax - 1) 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 0 for h in range(H) for h in range(H) h range(H) range H for h in range(H) 0 hc = [0 for h in range(H)] hc [0 for h in range(H)] 0 for w in range(W) for w in range(W) w range(W) range W for w in range(W) 0 wc = [0 for w in range(W)] wc [0 for w in range(W)] for _ in range(M):
    h,w = map(int, input().split())
    h-=1
    w-=1
    bombs.add((h, w))
    hc[h] += 1
    wc[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 h-=1 h 1 w-=1 w 1 bombs.add((h, w)) bombs.add bombs add (h, w) h w hc[h] += 1 hc[h] hc h 1 wc[w] += 1 wc[w] wc w 1 hmax = max(hc) hmax max(hc) max hc wmax = max(wc) wmax max(wc) max wc htable = [] htable [] for h in range(H):
    if hc[h] == hmax:
        htable.append(h) h range(H) range H if hc[h] == hmax:
        htable.append(h) hc[h] == hmax hc[h] hc h hmax htable.append(h) htable.append htable append h wtable = [] wtable [] for w in range(W):
    if wc[w] == wmax:
        wtable.append(w)

# print(uw, uh)
#print(grid)
#print(wc, uw)
#print(hc, uh) w range(W) range W if wc[w] == wmax:
        wtable.append(w)

# print(uw, uh)
#print(grid)
#print(wc, uw)
#print(hc, uh) wc[w] == wmax wc[w] wc w wmax wtable.append(w) wtable.append wtable append w found = False found False for h in htable:
    for w in wtable:
        if (h,w) not in bombs:
            print(hmax + wmax)
            exit(0) h htable for w in wtable:
        if (h,w) not in bombs:
            print(hmax + wmax)
            exit(0) w wtable if (h,w) not in bombs:
            print(hmax + wmax)
            exit(0) (h,w) not in bombs (h,w) h w bombs print(hmax + wmax) print hmax + wmax hmax wmax exit(0) exit 0 print(hmax + wmax - 1) print hmax + wmax - 1 hmax + wmax hmax wmax 1 h,w = map(int, input().split()) map(int, input().split()) h hmax = max(hc) max(hc) hmax M = map(int, input().split()) map(int, input().split()) M wmax = max(wc) max(wc) wmax wtable = [] [] wtable H,W,M = map(int, input().split()) map(int, input().split()) H W,M = map(int, input().split()) map(int, input().split()) W w-=1 1 w wc = [0 for w in range(W)] [0 for w in range(W)] wc h-=1 1 h htable = [] [] htable found = False False found bombs = set() set() bombs w = map(int, input().split()) map(int, input().split()) w hc = [0 for h in range(H)] [0 for h in range(H)] hc
H,W,M = map(int, input().split())
# grid = [[0 for _ in range(W)] for _ in range(H)]
bombs = set()

hc = [0 for h in range(H)]
wc = [0 for w in range(W)]

for _ in range(M):
    h,w = map(int, input().split())
    h-=1
    w-=1
    bombs.add((h, w))
    hc[h] += 1
    wc[w] += 1

hmax = max(hc)
wmax = max(wc)

htable = []
for h in range(H):
    if hc[h] == hmax:
        htable.append(h)

wtable = []
for w in range(W):
    if wc[w] == wmax:
        wtable.append(w)

# print(uw, uh)
#print(grid)
#print(wc, uw)
#print(hc, uh)

found = False
for h in htable:
    for w in wtable:
        if (h,w) not in bombs:
            print(hmax + wmax)
            exit(0)

print(hmax + wmax - 1)