H, W, M = gets.split.map(&:to_i)
pos = Hash.new
h_hash = Hash.new(0)
w_hash = Hash.new(0)
M.times do |i|
  h, w = gets.split.map(&:to_i)
  pos[[h, w]] = true
  h_hash[h] += 1
  w_hash[w] += 1
end
max_count = 0
h_hash.each_key do |hk|
  w_hash.each_key do |wk|
    count = h_hash[hk] + w_hash[wk]
    count -= 1 if pos.include?([hk, wk])
    max_count = count if max_count < count
  end
end
puts max_count
