h,w,m=gets.split.map(&:to_i)
ar=Array.new(h*w,0)
r_sum=Array.new(h,0)
c_sum=Array.new(w,0)
m.times.each do 
  i,j=gets.split.map(&:to_i)
  ar[(i-1)*w+(j-1)]=1
  r_sum[i-1]+=1
  c_sum[j-1]+=1
end
ans=0
h.times do |i|
  w.times do |j|
    ans=[ans,r_sum[i]+c_sum[j]-ar[i*w+j]].max
  end
end
puts ans
