Given $$$n$$$ points on a two-dimensional plane, each point is labeled with a bracket, which may be either a left bracket ( or a right bracket ).
We say that a string $$$S$$$ is a valid bracket sequence if and only if it can be generated by the following recursive rules:
For example, (), (()), and ()() are valid bracket sequences, while )(, ((), and ())( are not valid bracket sequences.
Now you need to choose some distinct points from the given points as vertices to form a convex polygon.
In this problem, a polygon formed by $$$m$$$ points $$$p_{a_1},p_{a_2},\dots,p_{a_m}$$$ is called a convex polygon if and only if the following conditions are satisfied:
In other words, the selected points must appear exactly in the cyclic order of their own convex hull, and all interior angles must be strictly less than $$$180^\circ$$$; that is, the convex polygon has no three collinear points.
For a convex polygon, choose any vertex on its boundary as the starting point, and traverse all vertices along the polygon boundary in either clockwise or counterclockwise direction, stopping just before returning to the starting point. This yields a bracket sequence of length $$$m$$$: if the current vertex is labeled with a left bracket, write (; if it is labeled with a right bracket, write ).
Your task is to find a convex polygon containing at least one left bracket such that, for any vertex on the polygon labeled with a left bracket, the bracket sequence obtained by starting from that vertex and traversing the polygon boundary in either direction is a valid bracket sequence.
If such a convex polygon exists, output any one of them; otherwise, report no solution.
The first line contains an integer $$$T$$$ ($$$1\le T\le 400$$$), the number of test cases.
For each test case, the first line contains an integer $$$n$$$ ($$$1 \le n \le 2000$$$), the number of points.
The next $$$n$$$ lines each contain three integers $$$x_i,y_i,t_i$$$ ($$$0 \le x_i,y_i \le 10^9, t_i \in \{0,1\}$$$), representing the coordinates and bracket type of the $$$i$$$-th point. Here, $$$t_i = 0$$$ denotes a left bracket, and $$$t_i = 1$$$ denotes a right bracket.
It is guaranteed that, within each test case, all points are distinct and no three points are collinear.
It is also guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2000$$$.
For each test case, if there is no solution, output a single integer $$$-1$$$ on one line.
Otherwise, output the number of vertices $$$m$$$ of the selected convex polygon on the first line.
On the second line, output $$$m$$$ pairwise distinct integers $$$a_1,a_2,\ldots,a_m$$$, representing the indices of the selected points.
These points must be output in the order along the boundary of the convex polygon, either clockwise or counterclockwise.
541 1 02 4 13 9 04 16 151 1 02 4 03 9 04 16 15 25 1647 58 030 23 027 34 135 7 110 30 11 25 1810 5 010 16 01 5 024 9 06 2 06 12 07 18 13 13 110 0 0
41 2 3 4-141 3 2 4-1-1