import collections

h,w,m = map(int,input().split())

gyou = [0 for i in range(h)]
retu = [0 for i in range(w)]
l = []

for i in range(m):
    y,x = map(int,input().split())
    gyou[y-1] += 1
    retu[x-1] += 1
    l.append((y-1,x-1))

ymax = max(gyou)
xmax = max(retu)
c_ymax = gyou.count(ymax)
c_xmax = retu.count(xmax)
ans = ymax + xmax

c = 0
for y,x in l:
    if gyou[y] == ymax and retu[x] == xmax:
        c += 1

if c == c_ymax*c_xmax:
    print(ans-1)
else:
    print(ans) import collections collections h,w,m = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m 0 for i in range(h) for i in range(h) i range(h) range h for i in range(h) 0 gyou = [0 for i in range(h)] gyou [0 for i in range(h)] 0 for i in range(w) for i in range(w) i range(w) range w for i in range(w) 0 retu = [0 for i in range(w)] retu [0 for i in range(w)] l = [] l [] for i in range(m):
    y,x = map(int,input().split())
    gyou[y-1] += 1
    retu[x-1] += 1
    l.append((y-1,x-1)) i range(m) range m y,x = map(int,input().split()) y map(int,input().split()) map int input().split() ().split () input split x gyou[y-1] += 1 gyou[y-1] gyou y-1 y 1 1 retu[x-1] += 1 retu[x-1] retu x-1 x 1 1 l.append((y-1,x-1)) l.append l append (y-1,x-1) y-1 y 1 x-1 x 1 ymax = max(gyou) ymax max(gyou) max gyou xmax = max(retu) xmax max(retu) max retu c_ymax = gyou.count(ymax) c_ymax gyou.count(ymax) gyou.count gyou count ymax c_xmax = retu.count(xmax) c_xmax retu.count(xmax) retu.count retu count xmax ans = ymax + xmax ans ymax + xmax ymax xmax c = 0 c 0 for y,x in l:
    if gyou[y] == ymax and retu[x] == xmax:
        c += 1 y x l if gyou[y] == ymax and retu[x] == xmax:
        c += 1 gyou[y] == ymax and retu[x] == xmax gyou[y] == ymax gyou[y] gyou y ymax retu[x] == xmax retu[x] retu x xmax c += 1 c 1 if c == c_ymax*c_xmax:
    print(ans-1)
else:
    print(ans) c == c_ymax*c_xmax c c_ymax*c_xmax c_ymax c_xmax print(ans-1) print ans-1 ans 1 print(ans) print ans l = [] [] l ymax = max(gyou) max(gyou) ymax gyou = [0 for i in range(h)] [0 for i in range(h)] gyou c = 0 0 c y,x = map(int,input().split()) map(int,input().split()) y h,w,m = map(int,input().split()) map(int,input().split()) h c_xmax = retu.count(xmax) retu.count(xmax) c_xmax c += 1 1 c retu = [0 for i in range(w)] [0 for i in range(w)] retu x = map(int,input().split()) map(int,input().split()) x ans = ymax + xmax ymax + xmax ans c_ymax = gyou.count(ymax) gyou.count(ymax) c_ymax w,m = map(int,input().split()) map(int,input().split()) w m = map(int,input().split()) map(int,input().split()) m xmax = max(retu) max(retu) xmax
import collections

h,w,m = map(int,input().split())

gyou = [0 for i in range(h)]
retu = [0 for i in range(w)]
l = []

for i in range(m):
    y,x = map(int,input().split())
    gyou[y-1] += 1
    retu[x-1] += 1
    l.append((y-1,x-1))

ymax = max(gyou)
xmax = max(retu)
c_ymax = gyou.count(ymax)
c_xmax = retu.count(xmax)
ans = ymax + xmax

c = 0
for y,x in l:
    if gyou[y] == ymax and retu[x] == xmax:
        c += 1

if c == c_ymax*c_xmax:
    print(ans-1)
else:
    print(ans)