from collections import Counter

H, W, M = map(int, input().split())
dh, dw = Counter(), Counter()
used = set()

for _ in range(M):
    h, w = map(int, input().split())
    dh[h] += 1
    dw[w] += 1
    used.add((h, w))

ih = dh.most_common()
iw = dw.most_common()
s = ih[0][1] + iw[0][1]
ans = 0

for h, sh in ih:
    for w, sw in iw:
        if sh+sw < s or ans == s:
            break
        b = sh + sw - ((h, w) in used)
        ans = max(ans, b)
print(ans) from collections import Counter H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M dh, dw = Counter(), Counter() dh Counter() Counter dw Counter() Counter used = set() used set() set for _ in range(M):
    h, w = map(int, input().split())
    dh[h] += 1
    dw[w] += 1
    used.add((h, w)) _ range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w dh[h] += 1 dh[h] dh h 1 dw[w] += 1 dw[w] dw w 1 used.add((h, w)) used.add used add (h, w) h w ih = dh.most_common() ih dh.most_common() dh.most_common dh most_common iw = dw.most_common() iw dw.most_common() dw.most_common dw most_common s = ih[0][1] + iw[0][1] s ih[0][1] + iw[0][1] ih[0][1] [0] ih 0 1 iw[0][1] [0] iw 0 1 ans = 0 ans 0 for h, sh in ih:
    for w, sw in iw:
        if sh+sw < s or ans == s:
            break
        b = sh + sw - ((h, w) in used)
        ans = max(ans, b) h sh ih for w, sw in iw:
        if sh+sw < s or ans == s:
            break
        b = sh + sw - ((h, w) in used)
        ans = max(ans, b) w sw iw if sh+sw < s or ans == s:
            break
         sh+sw < s or ans == s sh+sw < s sh+sw sh sw s ans == s ans s break b = sh + sw - ((h, w) in used) b sh + sw - ((h, w) in used) sh + sw sh sw (h, w) in used (h, w) h w used ans = max(ans, b) ans max(ans, b) max ans b print(ans) print ans b = sh + sw - ((h, w) in used) sh + sw - ((h, w) in used) b H, W, M = map(int, input().split()) map(int, input().split()) H ans = 0 0 ans ans = max(ans, b) max(ans, b) ans h, w = map(int, input().split()) map(int, input().split()) h dh, dw = Counter(), Counter() Counter() dh dw = Counter(), Counter() Counter() dw w = map(int, input().split()) map(int, input().split()) w used = set() set() used iw = dw.most_common() dw.most_common() iw ih = dh.most_common() dh.most_common() ih s = ih[0][1] + iw[0][1] ih[0][1] + iw[0][1] s W, M = map(int, input().split()) map(int, input().split()) W M = map(int, input().split()) map(int, input().split()) M
from collections import Counter

H, W, M = map(int, input().split())
dh, dw = Counter(), Counter()
used = set()

for _ in range(M):
    h, w = map(int, input().split())
    dh[h] += 1
    dw[w] += 1
    used.add((h, w))

ih = dh.most_common()
iw = dw.most_common()
s = ih[0][1] + iw[0][1]
ans = 0

for h, sh in ih:
    for w, sw in iw:
        if sh+sw < s or ans == s:
            break
        b = sh + sw - ((h, w) in used)
        ans = max(ans, b)
print(ans)
