io = DATA.eof? ? STDIN : DATA
h,w,m=io.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=io.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*w).times do |k|
  i,j=k.divmod(w)
  ans=[ans,r_sum[i]+c_sum[j]-ar[k]].max
end
puts ans

__END__
