CF662B Graph Coloring
Description
You are given an undirected graph that consists of $ n $ vertices and $ m $ edges. Initially, each edge is colored either red or blue. Each turn a player picks a single vertex and switches the color of all edges incident to it. That is, all red edges with an endpoint in this vertex change the color to blue, while all blue edges with an endpoint in this vertex change the color to red.
Find the minimum possible number of moves required to make the colors of all edges equal.
Input Format
The first line of the input contains two integers $ n $ and $ m $ ( $ 1
Output Format
If there is no way to make the colors of all edges equal output $ -1 $ in the only line of the output. Otherwise first output $ k $ — the minimum number of moves required to achieve the goal, then output $ k $ integers $ a_{1},a_{2},...,a_{k} $ , where $ a_{i} $ is equal to the index of the vertex that should be used at the $ i $ -th move.
If there are multiple optimal sequences of moves, output any of them.