
n,m,t=map(int,input().split())

grid=[]

row=[0]*n
col=[0]*m

for _ in range(t):
    x,y=map(int,input().split())
    grid.append((x-1,y-1))
    row[x-1]+=1
    col[y-1]+=1

prow=[]
pcol=[]
qr=max(row)
for i in range(n):
    if row[i]==qr :
        prow.append(i)

qc=max(col)
for i in range(m):
    if col[i]==qc :
        pcol.append(i)

num=len(prow)*len(pcol)
ans=qr+qc
for i in grid:
    if row[i[0]]==qr and col[i[1]]==qc :
        num-=1
if num>0:
    print(ans)
else:
    print(ans-1) n,m,t=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m t grid=[] grid [] row=[0]*n row [0]*n [0] 0 n col=[0]*m col [0]*m [0] 0 m for _ in range(t):
    x,y=map(int,input().split())
    grid.append((x-1,y-1))
    row[x-1]+=1
    col[y-1]+=1 _ range(t) range t x,y=map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split y grid.append((x-1,y-1)) grid.append grid append (x-1,y-1) x-1 x 1 y-1 y 1 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 prow=[] prow [] pcol=[] pcol [] qr=max(row) qr max(row) max row for i in range(n):
    if row[i]==qr :
        prow.append(i) i range(n) range n if row[i]==qr :
        prow.append(i) row[i]==qr row[i] row i qr prow.append(i) prow.append prow append i qc=max(col) qc max(col) max col for i in range(m):
    if col[i]==qc :
        pcol.append(i) i range(m) range m if col[i]==qc :
        pcol.append(i) col[i]==qc col[i] col i qc pcol.append(i) pcol.append pcol append i num=len(prow)*len(pcol) num len(prow)*len(pcol) len(prow) len prow len(pcol) len pcol ans=qr+qc ans qr+qc qr qc for i in grid:
    if row[i[0]]==qr and col[i[1]]==qc :
        num-=1 i grid if row[i[0]]==qr and col[i[1]]==qc :
        num-=1 row[i[0]]==qr and col[i[1]]==qc row[i[0]]==qr row[i[0]] row i[0] i 0 qr col[i[1]]==qc col[i[1]] col i[1] i 1 qc num-=1 num 1 if num>0:
    print(ans)
else:
    print(ans-1) num>0 num 0 print(ans) print ans print(ans-1) print ans-1 ans 1 num-=1 1 num n,m,t=map(int,input().split()) map(int,input().split()) n prow=[] [] prow col=[0]*m [0]*m col pcol=[] [] pcol ans=qr+qc qr+qc ans qr=max(row) max(row) qr y=map(int,input().split()) map(int,input().split()) y x,y=map(int,input().split()) map(int,input().split()) x num=len(prow)*len(pcol) len(prow)*len(pcol) num m,t=map(int,input().split()) map(int,input().split()) m grid=[] [] grid row=[0]*n [0]*n row t=map(int,input().split()) map(int,input().split()) t qc=max(col) max(col) qc

n,m,t=map(int,input().split())

grid=[]

row=[0]*n
col=[0]*m

for _ in range(t):
    x,y=map(int,input().split())
    grid.append((x-1,y-1))
    row[x-1]+=1
    col[y-1]+=1

prow=[]
pcol=[]
qr=max(row)
for i in range(n):
    if row[i]==qr :
        prow.append(i)

qc=max(col)
for i in range(m):
    if col[i]==qc :
        pcol.append(i)

num=len(prow)*len(pcol)
ans=qr+qc
for i in grid:
    if row[i[0]]==qr and col[i[1]]==qc :
        num-=1
if num>0:
    print(ans)
else:
    print(ans-1)