H,W,M = gets.chomp.split.map(&:to_i)
n = M.times.map{gets.split.map(&:to_i)}


s = Array.new(H){Array.new(W, 0)}

(0..M-1).each do |i|
  (0..W-1).each do |x|
     s[n[i][0]-1][x] += 1  
  end
  (0..H-1).each do |y|
    s[y][n[i][1]-1] += 1
  end

s[n[i][0]-1][n[i][1]-1] -= 1

end


puts s.flatten.max





