h,w,m=map(int,input().split())

st=set()
h_b=[0 for i in range(h)]
w_b=[0 for i in range(w)]
for i in range(m):
  th,tw=map(int,input().split())
  th-=1
  tw-=1
  st.add((th,tw))
  h_b[th]+=1
  w_b[tw]+=1

h_max=max(h_b)
w_max=max(w_b)

h_cand=[i for i in range(h) if h_b[i]==h_max]
w_cand=[i for i in range(w) if w_b[i]==w_max]

for i in h_cand:
  for j in w_cand:
    if (i,j) not in st:
      print(h_max+w_max)
      exit()

print(h_max+w_max-1) h,w,m=map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m st=set() st set() set 0 for i in range(h) for i in range(h) i range(h) range h for i in range(h) 0 h_b=[0 for i in range(h)] h_b [0 for i in range(h)] 0 for i in range(w) for i in range(w) i range(w) range w for i in range(w) 0 w_b=[0 for i in range(w)] w_b [0 for i in range(w)] for i in range(m):
  th,tw=map(int,input().split())
  th-=1
  tw-=1
  st.add((th,tw))
  h_b[th]+=1
  w_b[tw]+=1 i range(m) range m th,tw=map(int,input().split()) th map(int,input().split()) map int input().split() ().split () input split tw th-=1 th 1 tw-=1 tw 1 st.add((th,tw)) st.add st add (th,tw) th tw h_b[th]+=1 h_b[th] h_b th 1 w_b[tw]+=1 w_b[tw] w_b tw 1 h_max=max(h_b) h_max max(h_b) max h_b w_max=max(w_b) w_max max(w_b) max w_b i for i in range(h) if h_b[i]==h_max for i in range(h) if h_b[i]==h_max i range(h) range h h_b[i]==h_max h_b[i] h_b i h_max if h_b[i]==h_max i h_cand=[i for i in range(h) if h_b[i]==h_max] h_cand [i for i in range(h) if h_b[i]==h_max] i for i in range(w) if w_b[i]==w_max for i in range(w) if w_b[i]==w_max i range(w) range w w_b[i]==w_max w_b[i] w_b i w_max if w_b[i]==w_max i w_cand=[i for i in range(w) if w_b[i]==w_max] w_cand [i for i in range(w) if w_b[i]==w_max] for i in h_cand:
  for j in w_cand:
    if (i,j) not in st:
      print(h_max+w_max)
      exit() i h_cand for j in w_cand:
    if (i,j) not in st:
      print(h_max+w_max)
      exit() j w_cand if (i,j) not in st:
      print(h_max+w_max)
      exit() (i,j) not in st (i,j) i j st print(h_max+w_max) print h_max+w_max h_max w_max exit() exit print(h_max+w_max-1) print h_max+w_max-1 h_max+w_max h_max w_max 1 h_b=[0 for i in range(h)] [0 for i in range(h)] h_b w_b=[0 for i in range(w)] [0 for i in range(w)] w_b th,tw=map(int,input().split()) map(int,input().split()) th w_max=max(w_b) max(w_b) w_max m=map(int,input().split()) map(int,input().split()) m h,w,m=map(int,input().split()) map(int,input().split()) h w_cand=[i for i in range(w) if w_b[i]==w_max] [i for i in range(w) if w_b[i]==w_max] w_cand tw-=1 1 tw w,m=map(int,input().split()) map(int,input().split()) w st=set() set() st h_max=max(h_b) max(h_b) h_max h_cand=[i for i in range(h) if h_b[i]==h_max] [i for i in range(h) if h_b[i]==h_max] h_cand tw=map(int,input().split()) map(int,input().split()) tw th-=1 1 th
h,w,m=map(int,input().split())

st=set()
h_b=[0 for i in range(h)]
w_b=[0 for i in range(w)]
for i in range(m):
  th,tw=map(int,input().split())
  th-=1
  tw-=1
  st.add((th,tw))
  h_b[th]+=1
  w_b[tw]+=1

h_max=max(h_b)
w_max=max(w_b)

h_cand=[i for i in range(h) if h_b[i]==h_max]
w_cand=[i for i in range(w) if w_b[i]==w_max]

for i in h_cand:
  for j in w_cand:
    if (i,j) not in st:
      print(h_max+w_max)
      exit()

print(h_max+w_max-1)