from collections import defaultdict
import heapq

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

col_cnt = [0] * W
row_cnt = [0] * H
col_max = 0
row_max = 0

w2h = defaultdict(list)
h2w = defaultdict(list)
bombs = set()

for _ in range(M):
    h, w = map(lambda x:int(x)-1, input().split())
    row_cnt[h] += 1
    col_cnt[w] += 1
    row_max = max(row_max, row_cnt[h])
    col_max = max(col_max, col_cnt[w])
    bombs.add((h, w))

max_rows = set()
max_cols = set()

for h in range(H):
    if row_cnt[h] == row_max:
        max_rows.add(h)
for w in range(W):
    if col_cnt[w] == col_max:
        max_cols.add(w)

cnt = 0
for h, w in bombs:
    if h in max_rows and w in max_cols:
        cnt += 1

if cnt == len(max_rows) * len(max_cols):
    print(row_max + col_max-1)
else:
    print(row_max + col_max)
 from collections import defaultdict import heapq heapq H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M col_cnt = [0] * W col_cnt [0] * W [0] 0 W row_cnt = [0] * H row_cnt [0] * H [0] 0 H col_max = 0 col_max 0 row_max = 0 row_max 0 w2h = defaultdict(list) w2h defaultdict(list) defaultdict list h2w = defaultdict(list) h2w defaultdict(list) defaultdict list bombs = set() bombs set() set for _ in range(M):
    h, w = map(lambda x:int(x)-1, input().split())
    row_cnt[h] += 1
    col_cnt[w] += 1
    row_max = max(row_max, row_cnt[h])
    col_max = max(col_max, col_cnt[w])
    bombs.add((h, w)) _ range(M) range M h, w = map(lambda x:int(x)-1, input().split()) h map(lambda x:int(x)-1, input().split()) map lambda x:int(x)-1 int(x)-1 int(x) int x 1 x input().split() ().split () input split w row_cnt[h] += 1 row_cnt[h] row_cnt h 1 col_cnt[w] += 1 col_cnt[w] col_cnt w 1 row_max = max(row_max, row_cnt[h]) row_max max(row_max, row_cnt[h]) max row_max row_cnt[h] row_cnt h col_max = max(col_max, col_cnt[w]) col_max max(col_max, col_cnt[w]) max col_max col_cnt[w] col_cnt w bombs.add((h, w)) bombs.add bombs add (h, w) h w max_rows = set() max_rows set() set max_cols = set() max_cols set() set for h in range(H):
    if row_cnt[h] == row_max:
        max_rows.add(h) h range(H) range H if row_cnt[h] == row_max:
        max_rows.add(h) row_cnt[h] == row_max row_cnt[h] row_cnt h row_max max_rows.add(h) max_rows.add max_rows add h for w in range(W):
    if col_cnt[w] == col_max:
        max_cols.add(w) w range(W) range W if col_cnt[w] == col_max:
        max_cols.add(w) col_cnt[w] == col_max col_cnt[w] col_cnt w col_max max_cols.add(w) max_cols.add max_cols add w cnt = 0 cnt 0 for h, w in bombs:
    if h in max_rows and w in max_cols:
        cnt += 1 h w bombs if h in max_rows and w in max_cols:
        cnt += 1 h in max_rows and w in max_cols h in max_rows h max_rows w in max_cols w max_cols cnt += 1 cnt 1 if cnt == len(max_rows) * len(max_cols):
    print(row_max + col_max-1)
else:
    print(row_max + col_max) cnt == len(max_rows) * len(max_cols) cnt len(max_rows) * len(max_cols) len(max_rows) len max_rows len(max_cols) len max_cols print(row_max + col_max-1) print row_max + col_max-1 row_max + col_max row_max col_max 1 print(row_max + col_max) print row_max + col_max row_max col_max max_rows = set() set() max_rows col_cnt = [0] * W [0] * W col_cnt H, W, M = map(int, input().split()) map(int, input().split()) H w2h = defaultdict(list) defaultdict(list) w2h h2w = defaultdict(list) defaultdict(list) h2w cnt = 0 0 cnt row_max = max(row_max, row_cnt[h]) max(row_max, row_cnt[h]) row_max h, w = map(lambda x:int(x)-1, input().split()) map(lambda x:int(x)-1, input().split()) h row_cnt = [0] * H [0] * H row_cnt max_cols = set() set() max_cols cnt += 1 1 cnt row_max = 0 0 row_max M = map(int, input().split()) map(int, input().split()) M W, M = map(int, input().split()) map(int, input().split()) W col_max = 0 0 col_max col_max = max(col_max, col_cnt[w]) max(col_max, col_cnt[w]) col_max w = map(lambda x:int(x)-1, input().split()) map(lambda x:int(x)-1, input().split()) w bombs = set() set() bombs
from collections import defaultdict
import heapq

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

col_cnt = [0] * W
row_cnt = [0] * H
col_max = 0
row_max = 0

w2h = defaultdict(list)
h2w = defaultdict(list)
bombs = set()

for _ in range(M):
    h, w = map(lambda x:int(x)-1, input().split())
    row_cnt[h] += 1
    col_cnt[w] += 1
    row_max = max(row_max, row_cnt[h])
    col_max = max(col_max, col_cnt[w])
    bombs.add((h, w))

max_rows = set()
max_cols = set()

for h in range(H):
    if row_cnt[h] == row_max:
        max_rows.add(h)
for w in range(W):
    if col_cnt[w] == col_max:
        max_cols.add(w)

cnt = 0
for h, w in bombs:
    if h in max_rows and w in max_cols:
        cnt += 1

if cnt == len(max_rows) * len(max_cols):
    print(row_max + col_max-1)
else:
    print(row_max + col_max)

