H, W, M = gets.split.map(&:to_i)
a = Array.new(H){ Array.new(W, false) }
b = Array.new(H, 0)
c = Array.new(W, 0)
M.times do
  h, w = gets.split.map{|s| s.to_i - 1}
  a[h][w] = true
  b[h] += 1
  c[w] += 1
end

ans = 0
[*0...H].product([*0...W]) do |x, y|
  count = b[x] + c[y]
  count -= 1 if a[x][y]
  ans = [ans, count].max
end

p ans

