def a(input)
  x = {}
  y = {}
  x_list = input.map{|v| v[0]}
  y_list = input.map{|v| v[1]}

  x_max = x_list.max
  y_max = y_list.max

  1.upto(x_max) do |v|
    x[v] = []
  end
  1.upto(y_max) do |v|
    y[v] = []
  end

  input.each.with_index(1) do |v, idx|
    x[v[0]] << idx
    y[v[1]] << idx
  end
  res = []
  input.each.with_index(1) do |v, idx|
    val = 1
    target_x = 1.upto(v[0] - 1).map do |t|
      x[t]
    end.flatten
    target_y = 1.upto(v[1] - 1).map do |t|
      y[t]
    end.flatten

    val += (target_x & target_y).size
    target_x = (v[0] +1).upto(x_max).map do |t|
      x[t]
    end.flatten
    target_y = (v[1] +1).upto(y_max).map do |t|
      y[t]
    end.flatten

    val += (target_x & target_y).size

    res << val
  end
  res
end

line = $stdin.gets
values = Array.new
while line = $stdin.gets
  values << line.chomp.split(' ').map(&:to_i)
end

puts a(values)