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.
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 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.
1 2 1 2
Number of Test Cases T , 1 < T <= 10
1 <= H[i], W[i] <= 10^9
Problem Setter : Vivek Bhatnagar
Time Limit : 1 Second