import itertools

H,W,M=map(int,input().split())
d={}
nh=[0]*H
nw=[0]*W
for _ in range(M):
    h,w=map(int,input().split())
    h-=1
    w-=1
    d[(h,w)]=1
    nh[h]+=1
    nw[w]+=1
hmax=max(nh)
wmax=max(nw)
is_h=[i for i in range(H) if nh[i]==hmax]
is_w=[i for i in range(W) if nw[i]==wmax]

for i_h,i_w in itertools.product(is_h,is_w):
    if (i_h,i_w) not in d:
        print(hmax+wmax)
        break
else:
    print(hmax+wmax-1) import itertools itertools H,W,M=map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M d={} d {} nh=[0]*H nh [0]*H [0] 0 H nw=[0]*W nw [0]*W [0] 0 W for _ in range(M):
    h,w=map(int,input().split())
    h-=1
    w-=1
    d[(h,w)]=1
    nh[h]+=1
    nw[w]+=1 _ range(M) range M h,w=map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w h-=1 h 1 w-=1 w 1 d[(h,w)]=1 d[(h,w)] d (h,w) h w 1 nh[h]+=1 nh[h] nh h 1 nw[w]+=1 nw[w] nw w 1 hmax=max(nh) hmax max(nh) max nh wmax=max(nw) wmax max(nw) max nw i for i in range(H) if nh[i]==hmax for i in range(H) if nh[i]==hmax i range(H) range H nh[i]==hmax nh[i] nh i hmax if nh[i]==hmax i is_h=[i for i in range(H) if nh[i]==hmax] is_h [i for i in range(H) if nh[i]==hmax] i for i in range(W) if nw[i]==wmax for i in range(W) if nw[i]==wmax i range(W) range W nw[i]==wmax nw[i] nw i wmax if nw[i]==wmax i is_w=[i for i in range(W) if nw[i]==wmax] is_w [i for i in range(W) if nw[i]==wmax] for i_h,i_w in itertools.product(is_h,is_w):
    if (i_h,i_w) not in d:
        print(hmax+wmax)
        break
else:
    print(hmax+wmax-1) i_h i_w itertools.product(is_h,is_w) itertools.product itertools product is_h is_w if (i_h,i_w) not in d:
        print(hmax+wmax)
        break (i_h,i_w) not in d (i_h,i_w) i_h i_w d print(hmax+wmax) print hmax+wmax hmax wmax break print(hmax+wmax-1) print hmax+wmax-1 hmax+wmax hmax wmax 1 d={} {} d is_h=[i for i in range(H) if nh[i]==hmax] [i for i in range(H) if nh[i]==hmax] is_h h-=1 1 h H,W,M=map(int,input().split()) map(int,input().split()) H M=map(int,input().split()) map(int,input().split()) M hmax=max(nh) max(nh) hmax nw=[0]*W [0]*W nw wmax=max(nw) max(nw) wmax W,M=map(int,input().split()) map(int,input().split()) W nh=[0]*H [0]*H nh h,w=map(int,input().split()) map(int,input().split()) h is_w=[i for i in range(W) if nw[i]==wmax] [i for i in range(W) if nw[i]==wmax] is_w w=map(int,input().split()) map(int,input().split()) w w-=1 1 w
import itertools

H,W,M=map(int,input().split())
d={}
nh=[0]*H
nw=[0]*W
for _ in range(M):
    h,w=map(int,input().split())
    h-=1
    w-=1
    d[(h,w)]=1
    nh[h]+=1
    nw[w]+=1
hmax=max(nh)
wmax=max(nw)
is_h=[i for i in range(H) if nh[i]==hmax]
is_w=[i for i in range(W) if nw[i]==wmax]

for i_h,i_w in itertools.product(is_h,is_w):
    if (i_h,i_w) not in d:
        print(hmax+wmax)
        break
else:
    print(hmax+wmax-1)