#P1211I. Unusual Graph
Unusual Graph
No submission language available for this problem.
Description
Ivan on his birthday was presented with array of non-negative integers . He immediately noted that all satisfy the condition .
Ivan likes graph theory very much, so he decided to transform his sequence to the graph.
There will be vertices in his graph, and vertices and will present in the graph if and only if binary notations of integers and are differ in exactly one bit (in other words, for some integer . Where is Bitwise XOR).
A terrible thing happened in a couple of days, Ivan forgot his sequence , and all that he remembers is constructed graph!
Can you help him, and find any sequence , such that graph constructed by the same rules that Ivan used will be the same as his graph?
The first line of input contain two integers (): number of vertices and edges in Ivan's graph.
Next lines contain the description of edges: -th line contain two integers (), describing undirected edge connecting vertices and in the graph.
It is guaranteed that there are no multiple edges in the graph. It is guaranteed that there exists some solution for the given graph.
Output space-separated integers, ().
Printed numbers should satisfy the constraints: edge between vertices and present in the graph if and only if for some integer .
It is guaranteed that there exists some solution for the given graph. If there are multiple possible solutions, you can output any.
Input
The first line of input contain two integers (): number of vertices and edges in Ivan's graph.
Next lines contain the description of edges: -th line contain two integers (), describing undirected edge connecting vertices and in the graph.
It is guaranteed that there are no multiple edges in the graph. It is guaranteed that there exists some solution for the given graph.
Output
Output space-separated integers, ().
Printed numbers should satisfy the constraints: edge between vertices and present in the graph if and only if for some integer .
It is guaranteed that there exists some solution for the given graph. If there are multiple possible solutions, you can output any.