题目描述
Steven Smith, being a phenomenal Test and ODI Batsmen got bored because of too much of T20's going on.
So he prepares a list of TEST runs and ODI runs of N Batsmen.
The list contains two integers for each Batsmen, Ti and Oi denoting Test runs and ODI runs of
ith Batsmen (1 ≤ i ≤ N).
Now, for each Batsmen, Smith decides to find - that particular batsmen is BETTER than how many other Batsmen?
BETTER is defined as :
1) If test runs of ith Batsmen is more than test runs of jth Batsmen && odi runs of ith is more than that of jth Batsmen,
then ith Batsmen is BETTER than jth Batsmen.
or2) If test runs of ith Batsmen is equal to that of jth Batsmen && odi runs of ithBatsmen is more than that of jth Batsmen, then ith Batsmen is BETTER.
or3) If odi runs of ith Batsmen is equal to that of jth Batsmen && test runs of ith Batsmen is more than that of jth Batsmen, then ith Batsmen is BETTER.
As number of Batsmen can be really large, Steven Smith decides to write a program for solving the problem. But as he has to go for the preparation of the next World-cup match,
he asks you to solve the problem for him?
Input : First line contains a integer N, number of Batsmen.
Next following N lines contains two integers separated by space, Ti and Oi denoting Test runs and ODI runs of
ith Batsmen (1 ≤ i ≤ N).
Output : Print N lines containing one integer per line, denoting ithbatsmen is BETTER than how many other Batsmen. (1 ≤ i ≤ N)
CONSTRAINS
1 ≤ N ≤ 10^6
1 ≤ Ti,Oi ≤10^6
Disclaimer : All Tests and ODI runs are fictional and has no relation and significance with real life.
SAMPLE INPUT
4
1000 2000
2500 300
3000 2000
2100 2000
SAMPLE OUTPUT
0
0
3
1
Explanation
1st Batsmen is not BETTER than any other Batsmen ,ie, 0
2nd Batsmen is also not BETTER than any other Batsmen ,ie, 0
3rd Batsmen is BETTER than all other Batsmen ,ie, 3
4th Batsmen is BETTER than the 1st Batsmen ,ie, 1
输入格式
见题面
输出格式
见题面