406184: GYM102302 I Useless Pokemino

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Useless Pokeminotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Laersh is a Pokemino trainer and he just captured his first pokemino. Throughout his journey he will capture more Pokeminos. Each Pokemino has an attack and a defense level. A Pokemino is better than another one if it has greater attack and greater defense level. Besides capturing Pokeminos, Laersh can breed any two Pokeminos that he owns and generate a new Pokemino. This new Pokemino's attack and defense will be a linear combination of its parents attributes:

Attackchild = Attackparent1 * c + Attackparent2 * (1 - c)

Defensechild = Defenseparent1 * c + Defenseparent2 * (1 - c)

The number c is the same for attack and defense, and can be any number 0 ≤ c ≤ 1.

An useless Pokemino is a Pokemino such that Laersh owns a better Pokemino, or he can breed a better Pokemino. For each new Pokemino that Laersh captures, help him figuring out the number of useless Pokeminos that he owns.

Input

The first line of the input contains one integer N (1 ≤ N ≤ 105). N lines will follow. The i-th line will contain two integers Ai (0 ≤ Ai ≤ 109) and Di (0 ≤ Di ≤ 109) each. Ai represents the attack of Pokemino i and Di represents the defense of Pokemino i. Note: No two captured Pokeminos will have the same attack and defense.

Output

Output N numbers, the i-th number represents how many useless Pokeminos there are when the i-th Pokemino is captured.

ExamplesInput
10
10 0
10 1
10 2
9 3
8 4
7 4
3 4
2 4
1 4
0 4
Output
0
0
0
0
0
0
0
0
0
0
Input
5
3 6
6 4
6 9
7 2
10 8
Output
0
0
1
2
3

Source/Category

加入题单

算法标签: