All Tracks Basic Programming Implementation Basics of Implementation Problem

Killjee And Easy Problem
Tag(s):

Very-Easy

Problem
Editorial
Analytics

Killjee is very tired too write a story So , Here goes the problem You are given a graph having n nodes and m edges.

You need to find an array of size \( \le 2*n \) such that every adjacent elements of the array have a edge between them in the given graph.

UPDATE

If there are multiple solutions please output anyone of them.

All vertices of the graph should be present in the array

sorry for delay in announcment :(

INPUT

First line of Input contain 2 integers n and m as specified in the problem statement.

OUTPUT

Print size of the array in the first line of your output print the array in second line of the output.

CONSTRAINTS

\(n \le 4*10^{5}\)

\(m \le 10^6\)

SAMPLE INPUT
3 3
1 2
1 3
2 3
SAMPLE OUTPUT
3
1 2 3
Explanation

1 is connected to 2 and 2 is connected to 3

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications

?