class UnionFind
  attr_accessor(:table)

  def initialize(n)
    @table = Array.new(n, -1)
  end

  def root(x)
    st = []
    tb = @table
    while tb[x] >= 0
      st.push(x)
      x = tb[x]
    end
    
    st.each do |y|
      @table[y] = x
    end
    
    return x
  end
  
  def find(x, y)
    return root(x) == root(y)
  end

  def unite(x, y)
    r1 = root(x)
    r2 = root(y)
    return if r1 == r2
    
    d1 = @table[r1]
    d2 = @table[r2]
    if d1 <= d2
      @table[r2] = r1
      @table[r1] += d2
    else
      @table[r1] = r2
      @table[r2] += d1
    end
  end
end

n = $stdin.readline.to_i
coord = Array.new(n) { $stdin.readline.chomp.split.map(&:to_i) }
coord = coord.map.with_index {|v, i| [v, i].flatten }.sort_by! {|x, _, _| x }
uf = UnionFind.new(n)

0.step(n - 2) do |i|
  (i + 1).step(n - 1) do |j|
    uf.unite(coord[i][2], coord[j][2]) if coord[i][1] < coord[j][1]
  end
end
n.times {|v| puts (- uf.table[uf.root(v)]) }