#K56987. Count Better Cards

    ID: 30320 Type: Default 1000ms 256MiB

Count Better Cards

Count Better Cards

You are given N cards, each with two integers A and B. For each card, determine the number of other cards that it is "better" than. A card i is considered better than card j if and only if:

$$A_i \geq A_j \quad \text{and} \quad B_i \geq B_j$$

Note that a card is not compared with itself. You need to output the result for each card in the same order as the input.

inputFormat

The first line contains an integer N (the number of cards).
Each of the following N lines contains two integers A and B, representing the values of a card.

outputFormat

Output N lines, where the ith line contains a single integer representing the number of cards that the ith card is better than.

## sample
5
10 20
15 25
20 30
25 35
5 10
1

2 3 4 0

</p>