H,W,M=map(int,input().split())
l = [ list(map(int,input().split(" "))) for i in range(M)]
h=[0]*H
w=[0]*W
for i in range(M):
    h[l[i][0]-1]+=1
    w[l[i][1]-1]+=1
maxh=max(h)
maxw=max(w)
hlist=[]
wlist=[]
for i in range(H):
    if h[i]==maxh:
        hlist.append(i)
for i in range(W):
    if w[i]==maxw:
        wlist.append(i)
c=0
for i in range(M):
  if h[l[i][0]-1]==maxh and w[l[i][1]-1]==maxw:
    c+=1
if len(hlist)*len(wlist)==c:
  print(maxh+maxw-1)
else:
  print(maxh+maxw) H,W,M=map(int,input().split()) H map(int,input().split()) map int input().split() ().split () input split W M list(map(int,input().split(" "))) for i in range(M) for i in range(M) i range(M) range M for i in range(M) list(map(int,input().split(" "))) list map(int,input().split(" ")) map int input().split(" ") ().split () input split " " l = [ list(map(int,input().split(" "))) for i in range(M)] l [ list(map(int,input().split(" "))) for i in range(M)] h=[0]*H h [0]*H [0] 0 H w=[0]*W w [0]*W [0] 0 W for i in range(M):
    h[l[i][0]-1]+=1
    w[l[i][1]-1]+=1 i range(M) range M h[l[i][0]-1]+=1 h[l[i][0]-1] h l[i][0]-1 l[i][0] [i] l i 0 1 1 w[l[i][1]-1]+=1 w[l[i][1]-1] w l[i][1]-1 l[i][1] [i] l i 1 1 1 maxh=max(h) maxh max(h) max h maxw=max(w) maxw max(w) max w hlist=[] hlist [] wlist=[] wlist [] for i in range(H):
    if h[i]==maxh:
        hlist.append(i) i range(H) range H if h[i]==maxh:
        hlist.append(i) h[i]==maxh h[i] h i maxh hlist.append(i) hlist.append hlist append i for i in range(W):
    if w[i]==maxw:
        wlist.append(i) i range(W) range W if w[i]==maxw:
        wlist.append(i) w[i]==maxw w[i] w i maxw wlist.append(i) wlist.append wlist append i c=0 c 0 for i in range(M):
  if h[l[i][0]-1]==maxh and w[l[i][1]-1]==maxw:
    c+=1 i range(M) range M if h[l[i][0]-1]==maxh and w[l[i][1]-1]==maxw:
    c+=1 h[l[i][0]-1]==maxh and w[l[i][1]-1]==maxw h[l[i][0]-1]==maxh h[l[i][0]-1] h l[i][0]-1 l[i][0] [i] l i 0 1 maxh w[l[i][1]-1]==maxw w[l[i][1]-1] w l[i][1]-1 l[i][1] [i] l i 1 1 maxw c+=1 c 1 if len(hlist)*len(wlist)==c:
  print(maxh+maxw-1)
else:
  print(maxh+maxw) len(hlist)*len(wlist)==c len(hlist)*len(wlist) len(hlist) len hlist len(wlist) len wlist c print(maxh+maxw-1) print maxh+maxw-1 maxh+maxw maxh maxw 1 print(maxh+maxw) print maxh+maxw maxh maxw W,M=map(int,input().split()) map(int,input().split()) W h=[0]*H [0]*H h wlist=[] [] wlist H,W,M=map(int,input().split()) map(int,input().split()) H hlist=[] [] hlist maxh=max(h) max(h) maxh c=0 0 c maxw=max(w) max(w) maxw c+=1 1 c M=map(int,input().split()) map(int,input().split()) M l = [ list(map(int,input().split(" "))) for i in range(M)] [ list(map(int,input().split(" "))) for i in range(M)] l w=[0]*W [0]*W w
H,W,M=map(int,input().split())
l = [ list(map(int,input().split(" "))) for i in range(M)]
h=[0]*H
w=[0]*W
for i in range(M):
    h[l[i][0]-1]+=1
    w[l[i][1]-1]+=1
maxh=max(h)
maxw=max(w)
hlist=[]
wlist=[]
for i in range(H):
    if h[i]==maxh:
        hlist.append(i)
for i in range(W):
    if w[i]==maxw:
        wlist.append(i)
c=0
for i in range(M):
  if h[l[i][0]-1]==maxh and w[l[i][1]-1]==maxw:
    c+=1
if len(hlist)*len(wlist)==c:
  print(maxh+maxw-1)
else:
  print(maxh+maxw)