h, w, m = gets.split(' ').to_i

h_hash = {}
w_hash = {}

m.times do
  height, width = gets.split(' ')
  if h_hash[height]
    h_hash[height] = h_hash[height] + 1
  else
    h_hash[height] = 1
  end

  if w_hash[width]
    w_hash[width] = w_hash[width] + 1
  else
    w_hash[width] = 1
  end
end

h_max = h_hash.values.max
w_max = w_hash.values.max

puts h_max + w_max