from collections import defaultdict
from operator import itemgetter
import sys
input = sys.stdin.readline

h, w, m = map(int, input().split())
bombs = [tuple(map(int, input().split())) for _ in range(m)]

x_cnt = defaultdict(int)
y_cnt = defaultdict(int)
for x, y in bombs:
    x_cnt[x] += 1
    y_cnt[y] += 1

x_cnt_max = max(x_cnt.values())
y_cnt_max = max(y_cnt.values())
cnt = cnt_x = cnt_y = 0
for x, y in bombs:
    if x_cnt[x] == x_cnt_max and y_cnt[y] == y_cnt_max:
        cnt += 1

cnt_x = sum(v == x_cnt_max for v in x_cnt.values())
cnt_y = sum(v == y_cnt_max for v in y_cnt.values())
if cnt_x * cnt_y == cnt:
    ans = x_cnt_max + y_cnt_max - 1
else:
    ans = x_cnt_max + y_cnt_max

# print(cnt_x, cnt_y, cnt)
print(ans) from collections import defaultdict from operator import itemgetter import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m tuple(map(int, input().split())) for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split bombs = [tuple(map(int, input().split())) for _ in range(m)] bombs [tuple(map(int, input().split())) for _ in range(m)] x_cnt = defaultdict(int) x_cnt defaultdict(int) defaultdict int y_cnt = defaultdict(int) y_cnt defaultdict(int) defaultdict int for x, y in bombs:
    x_cnt[x] += 1
    y_cnt[y] += 1 x y bombs x_cnt[x] += 1 x_cnt[x] x_cnt x 1 y_cnt[y] += 1 y_cnt[y] y_cnt y 1 x_cnt_max = max(x_cnt.values()) x_cnt_max max(x_cnt.values()) max x_cnt.values() x_cnt.values x_cnt values y_cnt_max = max(y_cnt.values()) y_cnt_max max(y_cnt.values()) max y_cnt.values() y_cnt.values y_cnt values cnt = cnt_x = cnt_y = 0 cnt 0 = cnt_x = cnt_y = 0 cnt_x 0 cnt_y for x, y in bombs:
    if x_cnt[x] == x_cnt_max and y_cnt[y] == y_cnt_max:
        cnt += 1 x y bombs if x_cnt[x] == x_cnt_max and y_cnt[y] == y_cnt_max:
        cnt += 1 x_cnt[x] == x_cnt_max and y_cnt[y] == y_cnt_max x_cnt[x] == x_cnt_max x_cnt[x] x_cnt x x_cnt_max y_cnt[y] == y_cnt_max y_cnt[y] y_cnt y y_cnt_max cnt += 1 cnt 1 cnt_x = sum(v == x_cnt_max for v in x_cnt.values()) cnt_x sum(v == x_cnt_max for v in x_cnt.values()) sum v == x_cnt_max v x_cnt_max cnt_y = sum(v == y_cnt_max for v in y_cnt.values()) cnt_y sum(v == y_cnt_max for v in y_cnt.values()) sum v == y_cnt_max v y_cnt_max if cnt_x * cnt_y == cnt:
    ans = x_cnt_max + y_cnt_max - 1
else:
    ans = x_cnt_max + y_cnt_max

# print(cnt_x, cnt_y, cnt) cnt_x * cnt_y == cnt cnt_x * cnt_y cnt_x cnt_y cnt ans = x_cnt_max + y_cnt_max - 1 ans x_cnt_max + y_cnt_max - 1 x_cnt_max + y_cnt_max x_cnt_max y_cnt_max 1 ans = x_cnt_max + y_cnt_max ans x_cnt_max + y_cnt_max x_cnt_max y_cnt_max print(ans) print ans m = map(int, input().split()) map(int, input().split()) m x_cnt_max = max(x_cnt.values()) max(x_cnt.values()) x_cnt_max cnt_x = sum(v == x_cnt_max for v in x_cnt.values()) sum(v == x_cnt_max for v in x_cnt.values()) cnt_x w, m = map(int, input().split()) map(int, input().split()) w cnt_y = sum(v == y_cnt_max for v in y_cnt.values()) sum(v == y_cnt_max for v in y_cnt.values()) cnt_y input = sys.stdin.readline sys.stdin.readline input cnt = cnt_x = cnt_y = 0 0 cnt bombs = [tuple(map(int, input().split())) for _ in range(m)] [tuple(map(int, input().split())) for _ in range(m)] bombs cnt_y = 0 0 cnt_y x_cnt = defaultdict(int) defaultdict(int) x_cnt cnt_x = cnt_y = 0 0 cnt_x y_cnt_max = max(y_cnt.values()) max(y_cnt.values()) y_cnt_max ans = x_cnt_max + y_cnt_max - 1 x_cnt_max + y_cnt_max - 1 ans h, w, m = map(int, input().split()) map(int, input().split()) h cnt += 1 1 cnt y_cnt = defaultdict(int) defaultdict(int) y_cnt ans = x_cnt_max + y_cnt_max x_cnt_max + y_cnt_max ans
from collections import defaultdict
from operator import itemgetter
import sys
input = sys.stdin.readline

h, w, m = map(int, input().split())
bombs = [tuple(map(int, input().split())) for _ in range(m)]

x_cnt = defaultdict(int)
y_cnt = defaultdict(int)
for x, y in bombs:
    x_cnt[x] += 1
    y_cnt[y] += 1

x_cnt_max = max(x_cnt.values())
y_cnt_max = max(y_cnt.values())
cnt = cnt_x = cnt_y = 0
for x, y in bombs:
    if x_cnt[x] == x_cnt_max and y_cnt[y] == y_cnt_max:
        cnt += 1

cnt_x = sum(v == x_cnt_max for v in x_cnt.values())
cnt_y = sum(v == y_cnt_max for v in y_cnt.values())
if cnt_x * cnt_y == cnt:
    ans = x_cnt_max + y_cnt_max - 1
else:
    ans = x_cnt_max + y_cnt_max

# print(cnt_x, cnt_y, cnt)
print(ans)
