program a1

implicit none
integer, allocatable :: z(:), ans(:), order(:)
integer :: n, i, x, y, j

read *, n

allocate(z(1:n))
allocate(ans(1:n))
allocate(order(1:n))

do i = 1, n
 read *, x, y
 z(x) = y
 order(i) = x
end do

ans(:) = 1

do i = 1, n-1
 do j = i+1, n
  if(z(i) > z(j)) then
   ans(i) = ans(i) + 1
   ans(j) = ans(j) + 1
  end if
 end do
end do

do i = 1, n
 print *, ans(order(i))
end do

end program a1