All Submissions


Many of u ,must have had,PT n games for 4 semesters.Now sir want BIT to win the Eastern Zonal football league.So for all the total F students of the batch,he divides them into smallers groups so that the students within a group can practice and compete with each other. But as we percieve,students are generally scared of tall nd bulky people,and so are petrified to get into the same group having such player. In other words, student X is afraid of student Y,if weight(X)<=weight(Y) and height(X)<=height(Y).You can consider that no two students have both height and weight equal to each other.The groups are formed by the sir using following technique..

Everyone (all the F students) is made to stand in a line.For P=1,2,3...in order, in the Pth turn sir calls all the students who are not scared of any one in the line. they all come in front, make a group number P and leave for practice. This process is repeated as long as there exists students in the line yet to form a group. Given the height and weight of each of the F students, find the number of groups formed and the number of students in each of them.

Input

1st line: An Integer T denoting the number of test cases.
Each test Case Contains: one integer N(number of students 1<=N<=10,000).
Each of the following lines contains height and weight of ith student.

Output

Output K, total numbers of groups formed,in first line.
In next line output P1 P2 P3..., where Pi is the number of students in each group.Every value of Pi should be followed by a single blank space.

Sample Input


2
3
3 4
5 5
4 3
6
7 7
4 7
5 5
1 2
3 4
2 1


Sample Output


2
1 2
4
1 2 1 2


Constraints

Number of Test Cases T , 1 < T <= 10
1 <= H[i], W[i] <= 10^9

Problem Setter : Vivek Bhatnagar

Time Limit : 1 Second

Languages: C,C++,C#,Java,JavaScript,Pascal,Perl,PHP,Python,Ruby

Time Limit: 1 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0