n = gets.strip.to_i
town = []
n.times do
  x, y = gets.strip.split.map(&:to_i)
  town << [x, y]
end

checked = []
checked_gone = []
town.each_with_index do |t, i|
  now = t
  gone = [t]
  can = []
  town_clone = town.clone

  loop do
    town_clone = town_clone - can - gone
    town_clone.each do |xx, yy|
      can << [xx, yy] if (xx < now[0] && yy < now[1]) || (xx > now[0] && yy > now[1])
    end

    break if can.length == 0

    gone << now

    index = checked.index(now)
    if index
      gone << checked_gone[index]
      can -= checked_gone[index]
      gone.uniq!
      break if can.length == 0
    end

    now = can.shift
  end
  checked[i] = t
  checked_gone[i] = gone
  puts gone.length
end
