h,w,m=map(int,input().split())
d_h=[0]*(h+1)
d_w=[0]*(w+1)
d=[]
for i in range(m):
  nh,nw=map(int,input().split())
  d_h[nh]+=1
  d_w[nw]+=1
  d.append([nh,nw])
  
#print(d_h)
#print(d_w)

hantei=0
ans1=max(d_h)
memoh=set()
for i in range(1,h+1):
  hantei=d_h[i]
  if ans1==hantei:
    memoh.add(i)
    
hantei=0
ans2=max(d_w)
memow=set()
for j in range(1,w+1):
  hantei=d_w[j]
  if ans2 == hantei:
    memow.add(j)
ans = ans2+ans1-1
#print(memoh,memow)
count = len(memoh)*len(memow)
for hw in d:
  if hw[0] in memoh and hw[1] in memow:
    count-=1
if count>0:
  print(ans+1)
else:
  print(ans) h,w,m=map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m d_h=[0]*(h+1) d_h [0]*(h+1) [0] 0 h+1 h 1 d_w=[0]*(w+1) d_w [0]*(w+1) [0] 0 w+1 w 1 d=[] d [] for i in range(m):
  nh,nw=map(int,input().split())
  d_h[nh]+=1
  d_w[nw]+=1
  d.append([nh,nw])
  
#print(d_h)
#print(d_w) i range(m) range m nh,nw=map(int,input().split()) nh map(int,input().split()) map int input().split() ().split () input split nw d_h[nh]+=1 d_h[nh] d_h nh 1 d_w[nw]+=1 d_w[nw] d_w nw 1 d.append([nh,nw]) d.append d append [nh,nw] nh nw hantei=0 hantei 0 ans1=max(d_h) ans1 max(d_h) max d_h memoh=set() memoh set() set for i in range(1,h+1):
  hantei=d_h[i]
  if ans1==hantei:
    memoh.add(i)
     i range(1,h+1) range 1 h+1 h 1 hantei=d_h[i] hantei d_h[i] d_h i if ans1==hantei:
    memoh.add(i)
     ans1==hantei ans1 hantei memoh.add(i) memoh.add memoh add i hantei=0 hantei 0 ans2=max(d_w) ans2 max(d_w) max d_w memow=set() memow set() set for j in range(1,w+1):
  hantei=d_w[j]
  if ans2 == hantei:
    memow.add(j) j range(1,w+1) range 1 w+1 w 1 hantei=d_w[j] hantei d_w[j] d_w j if ans2 == hantei:
    memow.add(j) ans2 == hantei ans2 hantei memow.add(j) memow.add memow add j ans = ans2+ans1-1 ans ans2+ans1-1 ans2+ans1 ans2 ans1 1 count = len(memoh)*len(memow) count len(memoh)*len(memow) len(memoh) len memoh len(memow) len memow for hw in d:
  if hw[0] in memoh and hw[1] in memow:
    count-=1 hw d if hw[0] in memoh and hw[1] in memow:
    count-=1 hw[0] in memoh and hw[1] in memow hw[0] in memoh hw[0] hw 0 memoh hw[1] in memow hw[1] hw 1 memow count-=1 count 1 if count>0:
  print(ans+1)
else:
  print(ans) count>0 count 0 print(ans+1) print ans+1 ans 1 print(ans) print ans nh,nw=map(int,input().split()) map(int,input().split()) nh memow=set() set() memow h,w,m=map(int,input().split()) map(int,input().split()) h nw=map(int,input().split()) map(int,input().split()) nw hantei=0 0 hantei hantei=d_h[i] d_h[i] hantei d_w=[0]*(w+1) [0]*(w+1) d_w count = len(memoh)*len(memow) len(memoh)*len(memow) count w,m=map(int,input().split()) map(int,input().split()) w hantei=d_w[j] d_w[j] hantei memoh=set() set() memoh ans2=max(d_w) max(d_w) ans2 count-=1 1 count m=map(int,input().split()) map(int,input().split()) m hantei=0 0 hantei d=[] [] d ans1=max(d_h) max(d_h) ans1 ans = ans2+ans1-1 ans2+ans1-1 ans d_h=[0]*(h+1) [0]*(h+1) d_h
h,w,m=map(int,input().split())
d_h=[0]*(h+1)
d_w=[0]*(w+1)
d=[]
for i in range(m):
  nh,nw=map(int,input().split())
  d_h[nh]+=1
  d_w[nw]+=1
  d.append([nh,nw])
  
#print(d_h)
#print(d_w)

hantei=0
ans1=max(d_h)
memoh=set()
for i in range(1,h+1):
  hantei=d_h[i]
  if ans1==hantei:
    memoh.add(i)
    
hantei=0
ans2=max(d_w)
memow=set()
for j in range(1,w+1):
  hantei=d_w[j]
  if ans2 == hantei:
    memow.add(j)
ans = ans2+ans1-1
#print(memoh,memow)
count = len(memoh)*len(memow)
for hw in d:
  if hw[0] in memoh and hw[1] in memow:
    count-=1
if count>0:
  print(ans+1)
else:
  print(ans)
