#!/usr/bin/env python3

from pprint import pprint
import sys

sys.setrecursionlimit(10 ** 6)


H, W, M = map(int, input().split())

num_bombs_each_row = [0] * H
num_bombs_each_col = [0] * W
bombs = set()

for _ in range(M):
    h, w = map(int, input().split())
    # 0-index
    h -= 1
    w -= 1

    bombs.add((h, w))
    num_bombs_each_row[h] += 1
    num_bombs_each_col[w] += 1

max_bombs_in_row = max(num_bombs_each_row)
max_bombs_in_col = max(num_bombs_each_col)

rows_with_max_bombs = []
for row in range(H):
    if num_bombs_each_row[row] == max_bombs_in_row:
        rows_with_max_bombs.append(row)

cols_with_max_bombs = []
for col in range(W):
    if num_bombs_each_col[col] == max_bombs_in_col:
        cols_with_max_bombs.append(col)

found = False
for row in rows_with_max_bombs:
    for col in cols_with_max_bombs:
        if (row, col) not in bombs:
            found = True
            break

ans = max_bombs_in_row + max_bombs_in_col
if found:
    print(ans)
else:
    print(ans - 1) from pprint import pprint import sys sys sys.setrecursionlimit(10 ** 6) sys.setrecursionlimit sys setrecursionlimit 10 ** 6 10 6 H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M num_bombs_each_row = [0] * H num_bombs_each_row [0] * H [0] 0 H num_bombs_each_col = [0] * W num_bombs_each_col [0] * W [0] 0 W bombs = set() bombs set() set for _ in range(M):
    h, w = map(int, input().split())
    # 0-index
    h -= 1
    w -= 1

    bombs.add((h, w))
    num_bombs_each_row[h] += 1
    num_bombs_each_col[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 num_bombs_each_row[h] += 1 num_bombs_each_row[h] num_bombs_each_row h 1 num_bombs_each_col[w] += 1 num_bombs_each_col[w] num_bombs_each_col w 1 max_bombs_in_row = max(num_bombs_each_row) max_bombs_in_row max(num_bombs_each_row) max num_bombs_each_row max_bombs_in_col = max(num_bombs_each_col) max_bombs_in_col max(num_bombs_each_col) max num_bombs_each_col rows_with_max_bombs = [] rows_with_max_bombs [] for row in range(H):
    if num_bombs_each_row[row] == max_bombs_in_row:
        rows_with_max_bombs.append(row) row range(H) range H if num_bombs_each_row[row] == max_bombs_in_row:
        rows_with_max_bombs.append(row) num_bombs_each_row[row] == max_bombs_in_row num_bombs_each_row[row] num_bombs_each_row row max_bombs_in_row rows_with_max_bombs.append(row) rows_with_max_bombs.append rows_with_max_bombs append row cols_with_max_bombs = [] cols_with_max_bombs [] for col in range(W):
    if num_bombs_each_col[col] == max_bombs_in_col:
        cols_with_max_bombs.append(col) col range(W) range W if num_bombs_each_col[col] == max_bombs_in_col:
        cols_with_max_bombs.append(col) num_bombs_each_col[col] == max_bombs_in_col num_bombs_each_col[col] num_bombs_each_col col max_bombs_in_col cols_with_max_bombs.append(col) cols_with_max_bombs.append cols_with_max_bombs append col found = False found False for row in rows_with_max_bombs:
    for col in cols_with_max_bombs:
        if (row, col) not in bombs:
            found = True
            break row rows_with_max_bombs for col in cols_with_max_bombs:
        if (row, col) not in bombs:
            found = True
            break col cols_with_max_bombs if (row, col) not in bombs:
            found = True
            break (row, col) not in bombs (row, col) row col bombs found = True found True break ans = max_bombs_in_row + max_bombs_in_col ans max_bombs_in_row + max_bombs_in_col max_bombs_in_row max_bombs_in_col if found:
    print(ans)
else:
    print(ans - 1) found print(ans) print ans print(ans - 1) print ans - 1 ans 1 max_bombs_in_col = max(num_bombs_each_col) max(num_bombs_each_col) max_bombs_in_col w -= 1 1 w H, W, M = map(int, input().split()) map(int, input().split()) H max_bombs_in_row = max(num_bombs_each_row) max(num_bombs_each_row) max_bombs_in_row W, M = map(int, input().split()) map(int, input().split()) W bombs = set() set() bombs num_bombs_each_row = [0] * H [0] * H num_bombs_each_row h, w = map(int, input().split()) map(int, input().split()) h rows_with_max_bombs = [] [] rows_with_max_bombs M = map(int, input().split()) map(int, input().split()) M h -= 1 1 h cols_with_max_bombs = [] [] cols_with_max_bombs found = True True found found = False False found num_bombs_each_col = [0] * W [0] * W num_bombs_each_col ans = max_bombs_in_row + max_bombs_in_col max_bombs_in_row + max_bombs_in_col ans w = map(int, input().split()) map(int, input().split()) w
#!/usr/bin/env python3

from pprint import pprint
import sys

sys.setrecursionlimit(10 ** 6)


H, W, M = map(int, input().split())

num_bombs_each_row = [0] * H
num_bombs_each_col = [0] * W
bombs = set()

for _ in range(M):
    h, w = map(int, input().split())
    # 0-index
    h -= 1
    w -= 1

    bombs.add((h, w))
    num_bombs_each_row[h] += 1
    num_bombs_each_col[w] += 1

max_bombs_in_row = max(num_bombs_each_row)
max_bombs_in_col = max(num_bombs_each_col)

rows_with_max_bombs = []
for row in range(H):
    if num_bombs_each_row[row] == max_bombs_in_row:
        rows_with_max_bombs.append(row)

cols_with_max_bombs = []
for col in range(W):
    if num_bombs_each_col[col] == max_bombs_in_col:
        cols_with_max_bombs.append(col)

found = False
for row in rows_with_max_bombs:
    for col in cols_with_max_bombs:
        if (row, col) not in bombs:
            found = True
            break

ans = max_bombs_in_row + max_bombs_in_col
if found:
    print(ans)
else:
    print(ans - 1)
