|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||3||1||1||100.000%|
Councillors from the Los Hippopotalamos city are overwhelmed with complaints about traffic-jams in the city centre. Most people refuse to walk and prefer local means of transportation – the hippos. The problem is that downtown lanes are quite narrow and local hippos are rather large. When two hippos come across in the opposite directions they usually stuck in the lane and jam the traffic for a very long time. To prevent these collisions, the councillors have decided to change all lanes into one-way streets. However, the department of traffic and transportation couldn’t comply, because there are not enough traffic signs for such an operation. Situation is getting critical so the councillors have asked for your help.
You’ll get a map of the town described as an undirected planar graph and you’re supposed to direct all edges. The department of traffic and transportation warned you that from each vertex could lead at most 3 outgoing edges (number of incoming edges is not limited). You are not supposed to take care about any other details (such as vertex reachability or strong connectivity). If there are more correct solutions for a given graph you may present any one of them.
The first line of the input contains two numbers N and M (1 ≤ N ≤ 200 000, 1 ≤ M ≤ 1 000 000) where N represents number of vertices and M number of edges. The following M lines describe edges. Each edge is defined by numbers of two incident vertices i and j (1 ≤ i, j ≤ N). The graph is guaranteed to be planar, i.e., it is possible to draw it in the plane (vertices are points, edges are line segments) in such a way that no two edges have a point in common except possibly for their end vertices. There are no loops nor multiple edges in the graph.
Results are written in the very same format as the input is. Just do not forget that this time the edges are oriented (edge that is defined by vertices i and j is oriented from i to j). If the given graph has no solution at all you are supposed to write "no" string into the output file.
7 11 1 4 1 6 2 3 3 4 5 1 5 2 5 3 5 4 5 6 5 7 6 7
7 11 1 4 5 1 6 1 3 2 2 5 4 3 5 3 4 5 5 6 7 5 7 6