h,w,m=map(int,input().split())
h=[]
w=[]
for i in range(m):
  h_,w_=map(int,input().split())
  h.append(h_)
  w.append(w_)
from collections import Counter
dic_h=Counter(h)
dic_w=Counter(w)
max_h=max(dic_h.values())
max_w=max(dic_w.values())

h_set=set()
w_set=set()
for i in dic_h:
  if dic_h[i]==max_h:
    h_set.add(i)
for j in dic_w:
  if dic_w[j]==max_w:
    w_set.add(j)

cnt=0
for i in range(m):
  if h[i] in h_set and w[i] in w_set:
    cnt+=1
if len(h_set)*len(w_set)>cnt:
  print(max_h+max_w)
else:
  print(max_h+max_w-1)
  
   h,w,m=map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m h=[] h [] w=[] w [] for i in range(m):
  h_,w_=map(int,input().split())
  h.append(h_)
  w.append(w_) i range(m) range m h_,w_=map(int,input().split()) h_ map(int,input().split()) map int input().split() ().split () input split w_ h.append(h_) h.append h append h_ w.append(w_) w.append w append w_ from collections import Counter dic_h=Counter(h) dic_h Counter(h) Counter h dic_w=Counter(w) dic_w Counter(w) Counter w max_h=max(dic_h.values()) max_h max(dic_h.values()) max dic_h.values() dic_h.values dic_h values max_w=max(dic_w.values()) max_w max(dic_w.values()) max dic_w.values() dic_w.values dic_w values h_set=set() h_set set() set w_set=set() w_set set() set for i in dic_h:
  if dic_h[i]==max_h:
    h_set.add(i) i dic_h if dic_h[i]==max_h:
    h_set.add(i) dic_h[i]==max_h dic_h[i] dic_h i max_h h_set.add(i) h_set.add h_set add i for j in dic_w:
  if dic_w[j]==max_w:
    w_set.add(j) j dic_w if dic_w[j]==max_w:
    w_set.add(j) dic_w[j]==max_w dic_w[j] dic_w j max_w w_set.add(j) w_set.add w_set add j cnt=0 cnt 0 for i in range(m):
  if h[i] in h_set and w[i] in w_set:
    cnt+=1 i range(m) range m if h[i] in h_set and w[i] in w_set:
    cnt+=1 h[i] in h_set and w[i] in w_set h[i] in h_set h[i] h i h_set w[i] in w_set w[i] w i w_set cnt+=1 cnt 1 if len(h_set)*len(w_set)>cnt:
  print(max_h+max_w)
else:
  print(max_h+max_w-1)
  
   len(h_set)*len(w_set)>cnt len(h_set)*len(w_set) len(h_set) len h_set len(w_set) len w_set cnt print(max_h+max_w) print max_h+max_w max_h max_w print(max_h+max_w-1) print max_h+max_w-1 max_h+max_w max_h max_w 1 h_,w_=map(int,input().split()) map(int,input().split()) h_ cnt+=1 1 cnt w_set=set() set() w_set w=[] [] w dic_h=Counter(h) Counter(h) dic_h w,m=map(int,input().split()) map(int,input().split()) w h_set=set() set() h_set h,w,m=map(int,input().split()) map(int,input().split()) h w_=map(int,input().split()) map(int,input().split()) w_ max_h=max(dic_h.values()) max(dic_h.values()) max_h cnt=0 0 cnt max_w=max(dic_w.values()) max(dic_w.values()) max_w m=map(int,input().split()) map(int,input().split()) m h=[] [] h dic_w=Counter(w) Counter(w) dic_w
h,w,m=map(int,input().split())
h=[]
w=[]
for i in range(m):
  h_,w_=map(int,input().split())
  h.append(h_)
  w.append(w_)
from collections import Counter
dic_h=Counter(h)
dic_w=Counter(w)
max_h=max(dic_h.values())
max_w=max(dic_w.values())

h_set=set()
w_set=set()
for i in dic_h:
  if dic_h[i]==max_h:
    h_set.add(i)
for j in dic_w:
  if dic_w[j]==max_w:
    w_set.add(j)

cnt=0
for i in range(m):
  if h[i] in h_set and w[i] in w_set:
    cnt+=1
if len(h_set)*len(w_set)>cnt:
  print(max_h+max_w)
else:
  print(max_h+max_w-1)
  
  
