from collections import defaultdict
h, w, m = map(int, input().split())

row = [[0, 0] for _ in range(h + 1)]
col = [[0, 0] for _ in range(w + 1)]
ex = defaultdict(bool)
for i in range(m):
    r, c = map(int, input().split())
    row[r][0] += 1
    col[c][0] += 1
    row[r][1] = r
    col[c][1] = c
    ex[(r, c)] = True
row = sorted(row)[::-1]
col = sorted(col)[::-1]
ans = 0
for i in range(0, h + 1):
    for j in range(0, w + 1):
        ans = max(ans, row[i][0] + col[j][0] - ex[(row[i][1], col[j][1])])
        if not ex[(row[i][1], col[j][1])]:
            # iが同一だったら、jの値降順に見てるので木って良い
            break

print(ans) from collections import defaultdict h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m [0, 0] for _ in range(h + 1) for _ in range(h + 1) _ range(h + 1) range h + 1 h 1 for _ in range(h + 1) [0, 0] 0 0 row = [[0, 0] for _ in range(h + 1)] row [[0, 0] for _ in range(h + 1)] [0, 0] for _ in range(w + 1) for _ in range(w + 1) _ range(w + 1) range w + 1 w 1 for _ in range(w + 1) [0, 0] 0 0 col = [[0, 0] for _ in range(w + 1)] col [[0, 0] for _ in range(w + 1)] ex = defaultdict(bool) ex defaultdict(bool) defaultdict bool for i in range(m):
    r, c = map(int, input().split())
    row[r][0] += 1
    col[c][0] += 1
    row[r][1] = r
    col[c][1] = c
    ex[(r, c)] = True i range(m) range m r, c = map(int, input().split()) r map(int, input().split()) map int input().split() ().split () input split c row[r][0] += 1 row[r][0] [r] row r 0 1 col[c][0] += 1 col[c][0] [c] col c 0 1 row[r][1] = r row[r][1] [r] row r 1 r col[c][1] = c col[c][1] [c] col c 1 c ex[(r, c)] = True ex[(r, c)] ex (r, c) r c True row = sorted(row)[::-1] row sorted(row)[::-1] (row) sorted row ::-1 -1 col = sorted(col)[::-1] col sorted(col)[::-1] (col) sorted col ::-1 -1 ans = 0 ans 0 for i in range(0, h + 1):
    for j in range(0, w + 1):
        ans = max(ans, row[i][0] + col[j][0] - ex[(row[i][1], col[j][1])])
        if not ex[(row[i][1], col[j][1])]:
            # iが同一だったら、jの値降順に見てるので木って良い
            break i range(0, h + 1) range 0 h + 1 h 1 for j in range(0, w + 1):
        ans = max(ans, row[i][0] + col[j][0] - ex[(row[i][1], col[j][1])])
        if not ex[(row[i][1], col[j][1])]:
            # iが同一だったら、jの値降順に見てるので木って良い
            break j range(0, w + 1) range 0 w + 1 w 1 ans = max(ans, row[i][0] + col[j][0] - ex[(row[i][1], col[j][1])]) ans max(ans, row[i][0] + col[j][0] - ex[(row[i][1], col[j][1])]) max ans row[i][0] + col[j][0] - ex[(row[i][1], col[j][1])] row[i][0] + col[j][0] row[i][0] [i] row i 0 col[j][0] [j] col j 0 ex[(row[i][1], col[j][1])] ex (row[i][1], col[j][1]) row[i][1] [i] row i 1 col[j][1] [j] col j 1 if not ex[(row[i][1], col[j][1])]:
            # iが同一だったら、jの値降順に見てるので木って良い
            break not ex[(row[i][1], col[j][1])] ex[(row[i][1], col[j][1])] ex (row[i][1], col[j][1]) row[i][1] [i] row i 1 col[j][1] [j] col j 1 break print(ans) print ans row = [[0, 0] for _ in range(h + 1)] [[0, 0] for _ in range(h + 1)] row row = sorted(row)[::-1] sorted(row)[::-1] row col = sorted(col)[::-1] sorted(col)[::-1] col r, c = map(int, input().split()) map(int, input().split()) r ex = defaultdict(bool) defaultdict(bool) ex ans = max(ans, row[i][0] + col[j][0] - ex[(row[i][1], col[j][1])]) max(ans, row[i][0] + col[j][0] - ex[(row[i][1], col[j][1])]) ans w, m = map(int, input().split()) map(int, input().split()) w col = [[0, 0] for _ in range(w + 1)] [[0, 0] for _ in range(w + 1)] col m = map(int, input().split()) map(int, input().split()) m c = map(int, input().split()) map(int, input().split()) c ans = 0 0 ans h, w, m = map(int, input().split()) map(int, input().split()) h
from collections import defaultdict
h, w, m = map(int, input().split())

row = [[0, 0] for _ in range(h + 1)]
col = [[0, 0] for _ in range(w + 1)]
ex = defaultdict(bool)
for i in range(m):
    r, c = map(int, input().split())
    row[r][0] += 1
    col[c][0] += 1
    row[r][1] = r
    col[c][1] = c
    ex[(r, c)] = True
row = sorted(row)[::-1]
col = sorted(col)[::-1]
ans = 0
for i in range(0, h + 1):
    for j in range(0, w + 1):
        ans = max(ans, row[i][0] + col[j][0] - ex[(row[i][1], col[j][1])])
        if not ex[(row[i][1], col[j][1])]:
            # iが同一だったら、jの値降順に見てるので木って良い
            break

print(ans)
