eolymp
bolt
Try our new interface for solving problems
Problems

Potemkin cycle

Potemkin cycle

Prince Potemkin is well-known for his fake villages, created in haste to impress visiting dignitaries. He would lead the delegation along a closed route in his territory, and at each suitable site, a troupe of actors would erect a mobile village and pretend to be its inhabitants. Once the delegation moved, the actors disassembled the village and rushed ahead of the delegation to the next suitable site.

Of course, choosing the right route requires some thought. The members of the delegation occasionally leave the planned route for short inspection trips, and if they ever came back to a site they previously visited, the ruse would fail, since they would see an empty spot where they previously saw a village. Also, to properly impress, the route should pass through at least four sites.

You are given a map of Potemkin's territory, including the list of bidirectional direct roads among the suitable sites (the crossings among the direct roads are handled by an intricate system of overpasses, making it impossible for the dignitaries to switch from one road to another at any point other than its ends). Prince Potemkin asked you to find a sequence s1, ..., sm of sites such that:

  • m4,
  • all sites are different (that is, sisj for all ij),
  • si is joined to si+1 by a direct road for i = 1, ..., m - 1, and sm is joined to s1 by a direct road, and
  • there are no other direct roads among the sites in the sequence (i.e., for all i < j such that ji + 1 and either i1 or jm, the sites si and sj are not joined by a direct road).

Input

The first line contains two non-negative integers n and r (0n1000, 0r105), denoting the number of sites and the number of direct roads among them, respectively. The i-th of the following r lines contains two distinct positive integers ai and bi (1ai, bin), showing that the sites ai and bi are joined by a direct road. Each two sites are joined by at most one road.

Output

Write a sequence s1, ..., sm of pairwise distinct integers, describing a route as specified in the problem statement (an arbitrary one, if more valid sequences exist). If no such sequence exists, write "no" instead.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5 6
1 2
1 3
2 3
4 3
5 2
4 5
Output example #1
2 5 4 3
Input example #2
4 5
1 2
2 3
3 4
4 1
1 3
Output example #2
no
Source 2015 CEOI Day 1, Problem A