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

bomb_x = []
bomb_y = []
M.times do |i|
  bomb_x[i], bomb_y[i] = gets.chomp.split.map(&:to_i)
  bomb_x[i] -= 1
  bomb_y[i] -= 1
end

def count_bom(i, j, bomb_x, bomb_y)
  c = 0
  0.upto(H-1) do |h|
    M.times do |m|
      c += 1 if bomb_x[m] == h && bomb_y[m] == j
    end
  end

  0.upto(W-1) do |w|
    M.times do |m|
      c += 1 if bomb_x[m] == i && bomb_y[m] == w
    end
  end

  M.times do |m|
    c -= 1 if bomb_x[m] == i && bomb_y[m] == j
  end
  c
end

max = 0
0.upto(H-1) do |i|
  0.upto(W-1) do |j|
     max = [max, count_bom(i, j, bomb_x, bomb_y)].max
  end
end

print max