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

h_hash = {}
w_hash = {}

bombs = {}

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

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

  bombs[height][width] = true
end

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

height, width = h_hash.key(h_max), w_hash.key(w_max)

puts bombs[height][width] ? h_max + w_max - 1 : h_max + w_max
