h, w, m = list(map(int, input().split()))
ms = []
hs = [0 for i in range(h)]
ws = [0 for i in range(w)]

for i in range(m):
    hi, wi = list(map(int, input().split()))
    ms.append((hi - 1, wi - 1))
    hs[hi - 1] += 1
    ws[wi - 1] += 1

maxh = max(hs)
maxw = max(ws)
cnt_h = sum([hs[i] == maxh for i in range(h)])
cnt_w = sum([ws[i] == maxw for i in range(w)])
cnt = cnt_h * cnt_w

for x, y in ms:
    if hs[x] == maxh and ws[y] == maxw:
        cnt -= 1

if cnt <= 0:
    print(maxh + maxw - 1)
else:
    print(maxh + maxw) h, w, m = list(map(int, input().split())) h list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split w m ms = [] ms [] 0 for i in range(h) for i in range(h) i range(h) range h for i in range(h) 0 hs = [0 for i in range(h)] hs [0 for i in range(h)] 0 for i in range(w) for i in range(w) i range(w) range w for i in range(w) 0 ws = [0 for i in range(w)] ws [0 for i in range(w)] for i in range(m):
    hi, wi = list(map(int, input().split()))
    ms.append((hi - 1, wi - 1))
    hs[hi - 1] += 1
    ws[wi - 1] += 1 i range(m) range m hi, wi = list(map(int, input().split())) hi list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split wi ms.append((hi - 1, wi - 1)) ms.append ms append (hi - 1, wi - 1) hi - 1 hi 1 wi - 1 wi 1 hs[hi - 1] += 1 hs[hi - 1] hs hi - 1 hi 1 1 ws[wi - 1] += 1 ws[wi - 1] ws wi - 1 wi 1 1 maxh = max(hs) maxh max(hs) max hs maxw = max(ws) maxw max(ws) max ws hs[i] == maxh for i in range(h) for i in range(h) i range(h) range h for i in range(h) hs[i] == maxh hs[i] hs i maxh cnt_h = sum([hs[i] == maxh for i in range(h)]) cnt_h sum([hs[i] == maxh for i in range(h)]) sum [hs[i] == maxh for i in range(h)] ws[i] == maxw for i in range(w) for i in range(w) i range(w) range w for i in range(w) ws[i] == maxw ws[i] ws i maxw cnt_w = sum([ws[i] == maxw for i in range(w)]) cnt_w sum([ws[i] == maxw for i in range(w)]) sum [ws[i] == maxw for i in range(w)] cnt = cnt_h * cnt_w cnt cnt_h * cnt_w cnt_h cnt_w for x, y in ms:
    if hs[x] == maxh and ws[y] == maxw:
        cnt -= 1 x y ms if hs[x] == maxh and ws[y] == maxw:
        cnt -= 1 hs[x] == maxh and ws[y] == maxw hs[x] == maxh hs[x] hs x maxh ws[y] == maxw ws[y] ws y maxw cnt -= 1 cnt 1 if cnt <= 0:
    print(maxh + maxw - 1)
else:
    print(maxh + maxw) cnt <= 0 cnt 0 print(maxh + maxw - 1) print maxh + maxw - 1 maxh + maxw maxh maxw 1 print(maxh + maxw) print maxh + maxw maxh maxw cnt -= 1 1 cnt hs = [0 for i in range(h)] [0 for i in range(h)] hs h, w, m = list(map(int, input().split())) list(map(int, input().split())) h maxh = max(hs) max(hs) maxh maxw = max(ws) max(ws) maxw cnt_h = sum([hs[i] == maxh for i in range(h)]) sum([hs[i] == maxh for i in range(h)]) cnt_h hi, wi = list(map(int, input().split())) list(map(int, input().split())) hi cnt_w = sum([ws[i] == maxw for i in range(w)]) sum([ws[i] == maxw for i in range(w)]) cnt_w wi = list(map(int, input().split())) list(map(int, input().split())) wi m = list(map(int, input().split())) list(map(int, input().split())) m w, m = list(map(int, input().split())) list(map(int, input().split())) w ms = [] [] ms ws = [0 for i in range(w)] [0 for i in range(w)] ws cnt = cnt_h * cnt_w cnt_h * cnt_w cnt
h, w, m = list(map(int, input().split()))
ms = []
hs = [0 for i in range(h)]
ws = [0 for i in range(w)]

for i in range(m):
    hi, wi = list(map(int, input().split()))
    ms.append((hi - 1, wi - 1))
    hs[hi - 1] += 1
    ws[wi - 1] += 1

maxh = max(hs)
maxw = max(ws)
cnt_h = sum([hs[i] == maxh for i in range(h)])
cnt_w = sum([ws[i] == maxw for i in range(w)])
cnt = cnt_h * cnt_w

for x, y in ms:
    if hs[x] == maxh and ws[y] == maxw:
        cnt -= 1

if cnt <= 0:
    print(maxh + maxw - 1)
else:
    print(maxh + maxw)