from collections import *
h, w, m = map(int, input().split())
mh = [0 for _ in range(h)]
mw = [0 for _ in range(w)]

z = []
for _ in range(m):
    x, y = map(int, input().split())
    z.append((x-1, y-1))
    mh[x-1] += 1
    mw[y-1] += 1

hc = Counter(mh)
wc= Counter(mw)
hm = max(mh)
wm= max(mw)

ans = hm + wm
tmp = 0
for x, y in z:
    if mh[x] + mw[y] == ans:
        tmp += 1

if tmp == hc[hm] * wc[wm]:
    print(ans - 1)
else:
    print(ans) from collections import * h, w, m = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w m 0 for _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) 0 mh = [0 for _ in range(h)] mh [0 for _ in range(h)] 0 for _ in range(w) for _ in range(w) _ range(w) range w for _ in range(w) 0 mw = [0 for _ in range(w)] mw [0 for _ in range(w)] z = [] z [] for _ in range(m):
    x, y = map(int, input().split())
    z.append((x-1, y-1))
    mh[x-1] += 1
    mw[y-1] += 1 _ range(m) range m x, y = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split y z.append((x-1, y-1)) z.append z append (x-1, y-1) x-1 x 1 y-1 y 1 mh[x-1] += 1 mh[x-1] mh x-1 x 1 1 mw[y-1] += 1 mw[y-1] mw y-1 y 1 1 hc = Counter(mh) hc Counter(mh) Counter mh wc= Counter(mw) wc Counter(mw) Counter mw hm = max(mh) hm max(mh) max mh wm= max(mw) wm max(mw) max mw ans = hm + wm ans hm + wm hm wm tmp = 0 tmp 0 for x, y in z:
    if mh[x] + mw[y] == ans:
        tmp += 1 x y z if mh[x] + mw[y] == ans:
        tmp += 1 mh[x] + mw[y] == ans mh[x] + mw[y] mh[x] mh x mw[y] mw y ans tmp += 1 tmp 1 if tmp == hc[hm] * wc[wm]:
    print(ans - 1)
else:
    print(ans) tmp == hc[hm] * wc[wm] tmp hc[hm] * wc[wm] hc[hm] hc hm wc[wm] wc wm print(ans - 1) print ans - 1 ans 1 print(ans) print ans w, m = map(int, input().split()) map(int, input().split()) w wc= Counter(mw) Counter(mw) wc ans = hm + wm hm + wm ans m = map(int, input().split()) map(int, input().split()) m tmp = 0 0 tmp z = [] [] z x, y = map(int, input().split()) map(int, input().split()) x h, w, m = map(int, input().split()) map(int, input().split()) h hm = max(mh) max(mh) hm wm= max(mw) max(mw) wm tmp += 1 1 tmp mw = [0 for _ in range(w)] [0 for _ in range(w)] mw mh = [0 for _ in range(h)] [0 for _ in range(h)] mh y = map(int, input().split()) map(int, input().split()) y hc = Counter(mh) Counter(mh) hc
from collections import *
h, w, m = map(int, input().split())
mh = [0 for _ in range(h)]
mw = [0 for _ in range(w)]

z = []
for _ in range(m):
    x, y = map(int, input().split())
    z.append((x-1, y-1))
    mh[x-1] += 1
    mw[y-1] += 1

hc = Counter(mh)
wc= Counter(mw)
hm = max(mh)
wm= max(mw)

ans = hm + wm
tmp = 0
for x, y in z:
    if mh[x] + mw[y] == ans:
        tmp += 1

if tmp == hc[hm] * wc[wm]:
    print(ans - 1)
else:
    print(ans)
