import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

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

rows = [0] * (H + 1)
cols = [0] * (W + 1)

from collections import defaultdict
ng_cols = defaultdict(set)

for _ in range(M):
    h, w = map(int, input().split())
    rows[h] += 1
    cols[w] += 1
    ng_cols[h].add(w)

max_of_rows = max(rows)
max_of_cols = max(cols)
max_rows_index = set()
max_cols_index = set()
for i in range(H + 1):
    if rows[i] == max_of_rows:
        max_rows_index.add(i)
for i in range(W + 1):
    if cols[i] == max_of_cols:
        max_cols_index.add(i)
flag = 0
for i in max_rows_index:
    for j in max_cols_index:
        if j not in ng_cols[i]:
            flag = 1
            break
print(max_of_rows + max_of_cols - 1 + flag)





 import sys sys input = lambda: sys.stdin.readline().rstrip("\r\n") input lambda: sys.stdin.readline().rstrip("\r\n") sys.stdin.readline().rstrip("\r\n") sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip "\r\n" H, W, M = map(int, input().split()) H map(int, input().split()) map int input().split() ().split () input split W M rows = [0] * (H + 1) rows [0] * (H + 1) [0] 0 H + 1 H 1 cols = [0] * (W + 1) cols [0] * (W + 1) [0] 0 W + 1 W 1 from collections import defaultdict ng_cols = defaultdict(set) ng_cols defaultdict(set) defaultdict set for _ in range(M):
    h, w = map(int, input().split())
    rows[h] += 1
    cols[w] += 1
    ng_cols[h].add(w) _ range(M) range M h, w = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w rows[h] += 1 rows[h] rows h 1 cols[w] += 1 cols[w] cols w 1 ng_cols[h].add(w) [h].add [h] ng_cols h add w max_of_rows = max(rows) max_of_rows max(rows) max rows max_of_cols = max(cols) max_of_cols max(cols) max cols max_rows_index = set() max_rows_index set() set max_cols_index = set() max_cols_index set() set for i in range(H + 1):
    if rows[i] == max_of_rows:
        max_rows_index.add(i) i range(H + 1) range H + 1 H 1 if rows[i] == max_of_rows:
        max_rows_index.add(i) rows[i] == max_of_rows rows[i] rows i max_of_rows max_rows_index.add(i) max_rows_index.add max_rows_index add i for i in range(W + 1):
    if cols[i] == max_of_cols:
        max_cols_index.add(i) i range(W + 1) range W + 1 W 1 if cols[i] == max_of_cols:
        max_cols_index.add(i) cols[i] == max_of_cols cols[i] cols i max_of_cols max_cols_index.add(i) max_cols_index.add max_cols_index add i flag = 0 flag 0 for i in max_rows_index:
    for j in max_cols_index:
        if j not in ng_cols[i]:
            flag = 1
            break i max_rows_index for j in max_cols_index:
        if j not in ng_cols[i]:
            flag = 1
            break j max_cols_index if j not in ng_cols[i]:
            flag = 1
            break j not in ng_cols[i] j ng_cols[i] ng_cols i flag = 1 flag 1 break print(max_of_rows + max_of_cols - 1 + flag) print max_of_rows + max_of_cols - 1 + flag max_of_rows + max_of_cols - 1 max_of_rows + max_of_cols max_of_rows max_of_cols 1 flag max_of_rows = max(rows) max(rows) max_of_rows flag = 1 1 flag W, M = map(int, input().split()) map(int, input().split()) W max_rows_index = set() set() max_rows_index max_of_cols = max(cols) max(cols) max_of_cols H, W, M = map(int, input().split()) map(int, input().split()) H max_cols_index = set() set() max_cols_index input = lambda: sys.stdin.readline().rstrip("\r\n") lambda: sys.stdin.readline().rstrip("\r\n") input ng_cols = defaultdict(set) defaultdict(set) ng_cols h, w = map(int, input().split()) map(int, input().split()) h M = map(int, input().split()) map(int, input().split()) M cols = [0] * (W + 1) [0] * (W + 1) cols w = map(int, input().split()) map(int, input().split()) w flag = 0 0 flag rows = [0] * (H + 1) [0] * (H + 1) rows
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

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

rows = [0] * (H + 1)
cols = [0] * (W + 1)

from collections import defaultdict
ng_cols = defaultdict(set)

for _ in range(M):
    h, w = map(int, input().split())
    rows[h] += 1
    cols[w] += 1
    ng_cols[h].add(w)

max_of_rows = max(rows)
max_of_cols = max(cols)
max_rows_index = set()
max_cols_index = set()
for i in range(H + 1):
    if rows[i] == max_of_rows:
        max_rows_index.add(i)
for i in range(W + 1):
    if cols[i] == max_of_cols:
        max_cols_index.add(i)
flag = 0
for i in max_rows_index:
    for j in max_cols_index:
        if j not in ng_cols[i]:
            flag = 1
            break
print(max_of_rows + max_of_cols - 1 + flag)






