Trokuti
시간 제한4초메모리 제한1024 MB
6N개의 정점으로 이루어진 그래프가 2N개의 서로소 삼각형으로 분할 가능할 때, 그중 N개의 서로소 삼각형을 찾아 출력한다.
문제
An undirected graph with vertices and edges is given. An additional property of the graph is that it can be partitioned into disjoint triangles.
Find disjoint triangles in the graph.
입력
In the first line, there is a natural number (), which indicates the number of test cases.
This is followed by blocks of data.
In the first line of each block, there are natural numbers and (, ).
In the next lines, there are two natural numbers and (), which indicate that there is an edge between vertices and .
The sum of all values of across all test cases will not exceed .
출력
For each test case, output lines, each line containing three natural numbers , , (), which indicate that the vertices , , and form a triangle.