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

hlist=[0]*(h+1)

wlist=[0]*(w+1)

cnt=set()





for i in range(m):

  a,b=list(map(int,input().split()))

  hlist[a]+=1

  wlist[b]+=1

  cnt.add((a,b))





hcnt,wcnt=max(hlist),max(wlist)





hhh=[i for i,v in enumerate(hlist) if v==hcnt]

www=[i for i,v in enumerate(wlist) if v==wcnt]





for i in hhh:

  for j in www:

    if not (i,j) in cnt:

      print((hcnt+wcnt))

      exit()





print((hcnt+wcnt-1))

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

hlist=[0]*(h+1)

wlist=[0]*(w+1)

cnt=set()





for i in range(m):

  a,b=list(map(int,input().split()))

  hlist[a]+=1

  wlist[b]+=1

  cnt.add((a,b))





hcnt,wcnt=max(hlist),max(wlist)





hhh=[i for i,v in enumerate(hlist) if v==hcnt]

www=[i for i,v in enumerate(wlist) if v==wcnt]





for i in hhh:

  for j in www:

    if (i,j) not in cnt:

      print((hcnt+wcnt))

      exit()





print((hcnt+wcnt-1))
h, w, m = list(map(int, input().split()))
hlist = [0] * (h + 1)
wlist = [0] * (w + 1)
cnt = set()
for i in range(m):
    a, b = list(map(int, input().split()))
    hlist[a] += 1
    wlist[b] += 1
    cnt.add((a, b))
hcnt, wcnt = max(hlist), max(wlist)
hhh = [i for i, v in enumerate(hlist) if v == hcnt]
www = [i for i, v in enumerate(wlist) if v == wcnt]
for i in hhh:
    for j in www:
        if not (i, j) in cnt:
            print((hcnt + wcnt))
            exit()
print((hcnt + wcnt - 1))

h, w, m = list(map(int, input().split()))
hlist = [0] * (h + 1)
wlist = [0] * (w + 1)
cnt = set()
for i in range(m):
    a, b = list(map(int, input().split()))
    hlist[a] += 1
    wlist[b] += 1
    cnt.add((a, b))
hcnt, wcnt = max(hlist), max(wlist)
hhh = [i for i, v in enumerate(hlist) if v == hcnt]
www = [i for i, v in enumerate(wlist) if v == wcnt]
for i in hhh:
    for j in www:
        if (i, j) not in cnt:
            print((hcnt + wcnt))
            exit()
print((hcnt + wcnt - 1))

-        if not (i, j) in cnt: +        if (i, j) not in cnt: