Path Partition
시간 제한15초메모리 제한2048 MB
무작위로 생성된 무방향 그래프의 모든 간선을 길이 3인 경로 M/3개로 분할하는데, 경로의 시작점과 끝점이 같아도 된다.
문제
This is an "output-only" problem. The test cases are made available to you. However, due to the large output size, you should still submit a program that reads the input and produces the outputs within the time limit.
Busy Beaver generated a random undirected graph with vertices and edges, where is a multiple of . Now, he wants to partition the edges into paths of length (possibly starting and ending at the same vertex). Can you help Busy Beaver find such a partition?
입력
Please download the test data using this link.
The first line of input contains two integers and --- the number of vertices and edges in the graph, respectively.
The th of the next lines contains two integers and () --- the endpoints of the th edge.
It is guaranteed that the edges were generated randomly. Formally, out of the possible edges, distinct edges were chosen uniformly at random without replacement.
출력
Output lines. The th line should contain integers , , , and (), representing a path using edges , , and .
It is allowed to have . Your output should satisfy
힌트
The sample is provided to illustrate the input and output format. It is not scored.
The sample graph and partition are shown in the figure below. Note that the path starts and ends at the same vertex, which is allowed.
