QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 512 MB Points totaux : 100

#8374. Graph

Statistiques

Given an undirected graph with $n$ vertices and $R$ edges, where vertices are labeled starting from 1. Find a sequence of vertices $S$ that satisfies the following conditions:

  1. The length of the sequence $m$ is greater than 3.
  2. All vertices in the sequence are distinct.
  3. There is an edge between adjacent vertices in the sequence, and there is also an edge between $S_1$ and $S_m$.
  4. The induced subgraph formed by the vertices in the sequence has exactly $m$ edges.

Input

The input is read from standard input. The first line contains two positive integers $n$ and $R$, representing the number of vertices and the number of edges, respectively. The next $R$ lines each contain two positive integers $x$ and $y$, where $1 \le x, y \le n$, representing an undirected edge between $x$ and $y$.

Output

Output to standard output. Output any sequence that satisfies the conditions described in the problem. If no such sequence exists, output no.

Examples

Input 1

5 6
1 2
1 3
2 3
4 3
5 2
4 5

Output 1

2 3 4 5

Input 2

4 5
1 2
2 3
3 4
4 1
1 3

Output 2

no

Constraints

Test Case $N \le$ $R \le$
1-3 10 45
4-5 100 1000
6-7 300 20000
8-10 1000 100000

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.