h,w,m = gets.chomp.split(' ').map(&:to_i)
i = 0
bombs = []
while i < m
  bomb = gets.chomp.split(' ').map(&:to_i)
  bombs << bomb
  i += 1
end
# p bombs
max = 0
# クローラー
i = 1
while i <= h
  j = 1
  while j <= w
    # p "[#{i},#{j}]"
    # bombsを見ていく
    k = 0
    count = 0
    while k < m #bombの数
      if bombs[k][0] == i || bombs[k][1] == j
        count += 1
      end
      k += 1
    end
    if count > max
      max = count
    end
    j += 1
  end
  i += 1
end
p max