from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import Counter

h,w,m=nii()

h_bomb=[0 for i in range(h)]
w_bomb=[0 for i in range(w)]

l=set()
for i in range(m):
  th,tw=nii()
  th-=1
  tw-=1
  h_bomb[th]+=1
  w_bomb[tw]+=1
  l.add((th,tw))

h_max=max(h_bomb)
w_max=max(w_bomb)

h_cand=[]
w_cand=[]

for i in range(len(h_bomb)):
  if h_bomb[i]==h_max:
    h_cand.append(i)

for i in range(len(w_bomb)):
  if w_bomb[i]==w_max:
    w_cand.append(i)

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

print(h_max+w_max-1) from sys import stdin nii=lambda:map(int,stdin.readline().split()) nii lambda:map(int,stdin.readline().split()) map(int,stdin.readline().split()) map int stdin.readline().split() stdin.readline().split stdin.readline() stdin.readline stdin readline split lnii=lambda:list(map(int,stdin.readline().split())) lnii lambda:list(map(int,stdin.readline().split())) list(map(int,stdin.readline().split())) list map(int,stdin.readline().split()) map int stdin.readline().split() stdin.readline().split stdin.readline() stdin.readline stdin readline split from collections import Counter h,w,m=nii() h nii() nii w m 0 for i in range(h) for i in range(h) i range(h) range h for i in range(h) 0 h_bomb=[0 for i in range(h)] h_bomb [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_bomb=[0 for i in range(w)] w_bomb [0 for i in range(w)] l=set() l set() set for i in range(m):
  th,tw=nii()
  th-=1
  tw-=1
  h_bomb[th]+=1
  w_bomb[tw]+=1
  l.add((th,tw)) i range(m) range m th,tw=nii() th nii() nii tw th-=1 th 1 tw-=1 tw 1 h_bomb[th]+=1 h_bomb[th] h_bomb th 1 w_bomb[tw]+=1 w_bomb[tw] w_bomb tw 1 l.add((th,tw)) l.add l add (th,tw) th tw h_max=max(h_bomb) h_max max(h_bomb) max h_bomb w_max=max(w_bomb) w_max max(w_bomb) max w_bomb h_cand=[] h_cand [] w_cand=[] w_cand [] for i in range(len(h_bomb)):
  if h_bomb[i]==h_max:
    h_cand.append(i) i range(len(h_bomb)) range len(h_bomb) len h_bomb if h_bomb[i]==h_max:
    h_cand.append(i) h_bomb[i]==h_max h_bomb[i] h_bomb i h_max h_cand.append(i) h_cand.append h_cand append i for i in range(len(w_bomb)):
  if w_bomb[i]==w_max:
    w_cand.append(i) i range(len(w_bomb)) range len(w_bomb) len w_bomb if w_bomb[i]==w_max:
    w_cand.append(i) w_bomb[i]==w_max w_bomb[i] w_bomb i w_max w_cand.append(i) w_cand.append w_cand append i for i in h_cand:
  for j in w_cand:
    if (i,j) not in l:
      print(h_max+w_max)
      exit() i h_cand for j in w_cand:
    if (i,j) not in l:
      print(h_max+w_max)
      exit() j w_cand if (i,j) not in l:
      print(h_max+w_max)
      exit() (i,j) not in l (i,j) i j l 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 w,m=nii() nii() w m=nii() nii() m w_bomb=[0 for i in range(w)] [0 for i in range(w)] w_bomb th,tw=nii() nii() th h,w,m=nii() nii() h nii=lambda:map(int,stdin.readline().split()) lambda:map(int,stdin.readline().split()) nii th-=1 1 th h_max=max(h_bomb) max(h_bomb) h_max tw-=1 1 tw w_cand=[] [] w_cand lnii=lambda:list(map(int,stdin.readline().split())) lambda:list(map(int,stdin.readline().split())) lnii h_bomb=[0 for i in range(h)] [0 for i in range(h)] h_bomb w_max=max(w_bomb) max(w_bomb) w_max h_cand=[] [] h_cand tw=nii() nii() tw l=set() set() l
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import Counter

h,w,m=nii()

h_bomb=[0 for i in range(h)]
w_bomb=[0 for i in range(w)]

l=set()
for i in range(m):
  th,tw=nii()
  th-=1
  tw-=1
  h_bomb[th]+=1
  w_bomb[tw]+=1
  l.add((th,tw))

h_max=max(h_bomb)
w_max=max(w_bomb)

h_cand=[]
w_cand=[]

for i in range(len(h_bomb)):
  if h_bomb[i]==h_max:
    h_cand.append(i)

for i in range(len(w_bomb)):
  if w_bomb[i]==w_max:
    w_cand.append(i)

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

print(h_max+w_max-1)
