h,w,m=map(int,input().split())
row=[0]*h
col=[0]*w
s=[]
for _ in range(m):
	x,y=map(int,input().split())
	row[x-1]+=1
	col[y-1]+=1
	s.append([x-1,y-1])
a,b=max(row),max(col)
aa=row.count(a)
bb=col.count(b)
c=0
for x,y in s:
	if row[x]==a and col[y]==b:c+=1
if c<aa*bb:print(a+b)
else:print(a+b-1) h,w,m=map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m row=[0]*h row [0]*h [0] 0 h col=[0]*w col [0]*w [0] 0 w s=[] s [] for _ in range(m):
	x,y=map(int,input().split())
	row[x-1]+=1
	col[y-1]+=1
	s.append([x-1,y-1]) _ range(m) range m x,y=map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split y row[x-1]+=1 row[x-1] row x-1 x 1 1 col[y-1]+=1 col[y-1] col y-1 y 1 1 s.append([x-1,y-1]) s.append s append [x-1,y-1] x-1 x 1 y-1 y 1 a,b=max(row),max(col) a max(row) max row b max(col) max col aa=row.count(a) aa row.count(a) row.count row count a bb=col.count(b) bb col.count(b) col.count col count b c=0 c 0 for x,y in s:
	if row[x]==a and col[y]==b:c+=1 x y s if row[x]==a and col[y]==b:c+= row[x]==a and col[y]==b row[x]==a row[x] row x a col[y]==b col[y] col y b if c<aa*bb:print(a+b)
else:print(a+b-1) c<aa*bb c aa*bb aa bb row=[0]*h [0]*h row s=[] [] s bb=col.count(b) col.count(b) bb b=max(row),max(col) max(col) b a,b=max(row),max(col) max(row) a c=0 0 c aa=row.count(a) row.count(a) aa y=map(int,input().split()) map(int,input().split()) y m=map(int,input().split()) map(int,input().split()) m x,y=map(int,input().split()) map(int,input().split()) x col=[0]*w [0]*w col w,m=map(int,input().split()) map(int,input().split()) w h,w,m=map(int,input().split()) map(int,input().split()) h
h,w,m=map(int,input().split())
row=[0]*h
col=[0]*w
s=[]
for _ in range(m):
	x,y=map(int,input().split())
	row[x-1]+=1
	col[y-1]+=1
	s.append([x-1,y-1])
a,b=max(row),max(col)
aa=row.count(a)
bb=col.count(b)
c=0
for x,y in s:
	if row[x]==a and col[y]==b:c+=1
if c<aa*bb:print(a+b)
else:print(a+b-1)