Triangle Trees
시간 제한4초메모리 제한2048 MB
모든 사이클이 삼각형인 무향 그래프, 즉 삼각형 트리를 최소 개수의 색으로 칠하는 문제입니다.
문제
A triangle tree is an undirected graph in which every cycle contains exactly three edges. Recall that a cycle is a sequence of at least distinct vertices such that there is an edge between and for and there is also an edge between and .
A colouring of a graph is an assignment of colours to the vertices such that the two endpoints of each edge of the graph receive different colours. Given a triangle tree, your task is to find a colouring which uses the smallest possible number of colours.

Figure 1: Illustration of the second sample case. The number written just outside the vertex corresponds to the colour it receives corresponding to the output for that sample case.
입력
The first line of input contains two integers () and (). The next lines each contain two integers and () indicating that the graph contains an edge between and . It is guaranteed that , all edges are unique, and that the graph is indeed a triangle tree.
출력
Output integers indicating the colours of vertices in order. If you used colours, the integers should be from the set . If there are multiple valid colourings, you may output any one of them. Recall the goal is to output such a colouring using the fewest colours possible, i.e. minimize .