io = DATA.eof? ? STDIN : DATA
h,w,m=io.gets.split.map(&:to_i)
ar=Array.new(h){Array.new(w){0}}
m.times.each do 
  i,j=io.gets.split.map(&:to_i)
  ar[i-1][j-1]=1
end
r_sum=Array.new(h)
c_sum=Array.new(w){0}
h.times do |i|
  r_sum[i]=ar[i].sum
  w.times do |j|
    c_sum[j]+=ar[i][j]
  end
end
ans=0
h.times do |i|
  w.times do |j|
    ans=[ans,r_sum[i]+c_sum[j]-ar[i][j]].max
  end
end

puts ans

__END__
