h,w,m = gets.chomp.split.map(&:to_i)
targets = []
m.times do 
  targets << gets.chomp.split.map(&:to_i)
end
result = []
h.times do |i|
  w.times do |j|
    count = 0
    count += targets.count{|target| target[0]==i+1}
    count += targets.count{|target| target[1]==j+1}
    count-=1 if targets.include?([i+1,j+1])
    result << count
  end
end
p result.max