Hide

Problem D
Dotty Daisy

Easter bunnies are very sociable creatures. They live in underground burrows (vertices) connected by tunnels (edges).

Easter bunny Daisy is dotty because she likes to visit friends by randomly travelling through a tunnel every hour. Sometimes she travels through the same tunnel repeatedly, and visits the same burrow multiple times.

Her friends want to know where she might be after $k$ hours (with $k$ tunnels travelled).

Input

The first line of the input contains three numbers $n$, $m$, and $k$ ($1 \le n \le 1{\, }000$, $1 \le m \le 200{\, }000$, $1 \le k \le 10^9$) — where $n$ is the number of burrows, $m$ is the number of tunnels, and $k$ is the number of tunnels travelled .

Each of the next $m$ lines contain two numbers, the burrows connected by a tunnel. A tunnel can connect a burrow to itself, while there can be at most one tunnel between a pair of burrows.

Daisy starts in burrow number 1, which is guaranteed to have at least $1$ tunnel connected.

Output

The first line of the output should contain the number $p$, the number of burrows where Daisy could be. The second line should contain $p$ numbers, giving the burrow numbers in increasing order.

Notes

In the first testcase, Daisy could travel from burrow $1$ to $2$, $2$ to $3$ and then $3$ to $1$, ending in burrow $1$. She could also travel from burrow $1$ to $3$, $3$ to $1$ and then $1$ to $2$, ending in burrow $2$. Similarly she could travel from burrow $1$ to $2$, $2$ to $1$ and then $1$ to $3$, ending in burrow $3$. Therefore, she might end up in any of the $3$ burrows after $3$ hours, or travelling $3$ tunnels.

Sample Input 1 Sample Output 1
3 3 3
1 2
1 3
2 3
3
1 2 3

Please log in to submit a solution to this problem

Log in