CF263D Cycle in Graph

Description

You've got a undirected graph $ G $ , consisting of $ n $ nodes. We will consider the nodes of the graph indexed by integers from 1 to $ n $ . We know that each node of graph $ G $ is connected by edges with at least $ k $ other nodes of this graph. Your task is to find in the given graph a simple cycle of length of at least $ k+1 $ . A simple cycle of length $ d $ $ (d>1) $ in graph $ G $ is a sequence of distinct graph nodes $ v_{1},v_{2},...,v_{d} $ such, that nodes $ v_{1} $ and $ v_{d} $ are connected by an edge of the graph, also for any integer $ i $ $ (1

Input Format

The first line contains three integers $ n $ , $ m $ , $ k $ $ (3

Output Format

In the first line print integer $ r $ $ (r>=k+1) $ — the length of the found cycle. In the next line print $ r $ distinct integers $ v_{1},v_{2},...,v_{r} $ $ (1