Jam's problem again

Time Limit: 2500ms
Memory Limit: 65536KB
This problem will be judged on HDU. Original ID: 5618
64-bit integer IO format: %I64d      Java class name: Main

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

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .