Body Size Ranking

No attempts yetTime limit1sMemory limit128 MB

Problem

We rank people's body size using two values: weight and height. If a person weighs xx kg and is yy cm tall, that person's body size is written as (x,y)(x, y).

Given two people A and B with body sizes (x,y)(x, y) and (p,q)(p, q), we say A's body size is larger than B's if x>px > p and y>qy > q. For example, if A and B have body sizes (56,177)(56, 177) and (45,165)(45, 165), then A is larger than B.

However, two body sizes are sometimes incomparable. For example, if C and D have body sizes (45,181)(45, 181) and (55,173)(55, 173), then D is heavier while C is taller, so by body size alone neither can be said to be larger than the other.

In a group of NN people, a person's rank is the number of people whose body size is larger than theirs. If exactly kk people are larger, that person's rank is k+1k + 1. Consequently, several people may share the same rank.

The table below shows the body sizes and ranks for a group of 5 people.

Name(weight, height)Rank
A(55, 185)2
B(58, 183)2
C(88, 186)1
D(60, 175)2
E(46, 155)5

No one is larger than C, so C is rank 1. Only C is larger than each of A, B, and D, so they are all rank 2. Four people (A, B, C, D) are larger than E, so E is rank 5. In this case ranks 3 and 4 do not appear.

Read the weight and height of NN people and output each person's rank.

Input

The first line contains the number of people NN. Each of the next NN lines contains two positive integers, the weight xx and height yy of one person, separated by a single space.

Output

On the first line, print each person's rank in the order given by the input, separated by single spaces.

Constraints

  • 2N502 \le N \le 50
  • 10x,y20010 \le x, y \le 200