H, W, M = gets.chomp.split.map(&:to_i)

bombs = []
M.times do |i|
  bombs << gets.chomp.split.map(&:to_i)
end

max = 0
1.upto(H) do |i|
  1.upto(W) do |j|
     c = bombs.count {|b| b.first == i || b.last == j }
     max = [max, c].max
  end
end

print max