Jam's problem again

Time Limit: 5000/2500 MS (Java/Others)

Memory Limit: 65536/65536 K (Java/Others)

[显示标签]

Description

Jam like to solve the problem which on the 3D-axis,given $N(1 \leq N \leq 100000)$ points $(x,y,z)(1 \leq x,y,z \leq 100000)$

If two point such as $(x_i,y_i,z_i)$ and $(x_j,y_j,z_j) \ x_i \geq x_j \ y_i \geq y_j \ z_i \geq z_j$, the bigger one level add $1$

Ask for the each level of the point.

Input

The first line is $T(1 \leq T \leq 15)$ means $T$ Case

For each case

The first line is $N$ means the number of Point and next there are $N$ line, each line has $(x,y,z)$

Output

Output with N line,each line has one number means the lever of point

Sample Input

1 4 10 4 7 10 6 6 8 2 5 7 3 10

Sample Output

1 1 0 0

Hint

hujie

Source

BestCoder Round #70

提交代码