Interesting excursion

아직 제출이 없습니다시간 제한4초메모리 제한512 MB

문제

Flatland has nn cities, connected by mm one-directional roads.

Tourist company plans to develop a scenic cyclic tour along the roads of Flatland. This tour must start and finish at the same city, visiting some intermediate cities and traveling along some of the roads in their direction. The tour can visit some city multiple times, but it may not use the same road more than once.

Each road is characterized by the type of its landscape, which is the number from 11 to mm. To make the tour really magnificent, every two adjacent roads in the tour must have different landscape types. This also should be true for the first and the last road in the tour, so that you start to travel from any city of the tour.

Help the company to find the tour satisfying these conditions, or report that no such tour exists.

입력

Input contains multiple test cases. First line contains integer TT (1T1051 \le T \le 10^5) --- the number of test cases.

First line of each test case's description contains two integers  nn and mm (2n,m21052 \le n, m \le 2 \cdot 10^5) --- number of cities and roads. Each of next mm lines contain three integers u_iu\_i v_iv\_i c_ic\_i, meaning that ii-th road starts at city u_iu\_i, ends at city v_iv\_i and has landscape type c_ic\_i (1u_i,v_in1 \le u\_i, v\_i \le n, 1c_im1 \le c\_i \le m, u_iv_iu\_i \neq v\_i).

Sum of all nn in all test cases does not exceed 21052 \cdot 10^5. Sum of all mm in all test cases does not exceed 21052 \cdot 10^5.

출력

Output the answer of each test case.

If the desired tour does not exist, output the only number <<1-1>>. Otherwise, print number k 2km2 \le k \le m --- the length of the tour. In next line print kk numbers e_1,e_2,,e_ke\_1, e\_2, \ldots, e\_k --- numbers of roads in the tour. All numbers e_ie\_i must be different. If there are multiple possible tours, output any of them.