Gourmet Tour
시간 제한0.5초메모리 제한1024 MB
트리의 각 노드에 1부터 n까지의 순위를 배정해 모든 간선의 순위 차이 절댓값이 1부터 n-1까지 서로 다르게 만든다.
문제
Minsu, who is attending university in Seoul, is planning a gourmet trip to Busan by train for the summer vacation. After researching all the restaurants along the way from Seoul to Busan, he finds that most of them are located in cities with stations on the Gyeongbu(GB) train line, and there are occasionally restaurants in cities a bit far from the GB train line stations. Minsu decides to visit the restaurants by getting off at the cities with stations while traveling from Seoul to Busan on the GB train line. In the case that a restaurant is in a city a bit far from a station on the GB train line, he plans to get off at the station, takes a taxi to the restaurant, visits it, and then returns to the station to catch the train again. Note that each city has one restaurant where he wants to visit. After successfully completing the trip, Minsu ranks the restaurants he has visited and discovers a curious fact. When he collects the values of the differences in the rankings of the restaurants that are in adjacent cities on his travel route, all the difference values are different. What can have been the rankings of the restaurants that Minsu gives?
Let us represent Minsu’s travel route in the form of a graph. The cities with stations on the GB train line or a bit far from that line where he visits restaurants are represented as nodes. Two nodes corresponding to consecutive cities on the GB train line are connected as an edge and two nodes corresponding to a city on the GB train line and a city a bit far from are also connected as an edge. When the total number of cities where Minsu visits restaurants is , the graph has nodes and edges. Nodes are numbered as distinct integers between and . For example, the figure below represents Minsu's travel route in the form of an undirected graph with nodes ( restaurants in cities).

The rankings of restaurants assigned by Minsu are integers from to without duplication. It can be considered as an assignment of rankings to nodes in the graph. The curious fact that Minsu discovers is that the differences of rankings assigned to any two adjacent nodes are all different. For example, the figure below represents the assigned rankings (blue numbers) and the differences (red numbers) of rankings between adjacent nodes. Note that the differences of rankings are integers from to without duplication.
Given a travel route graph for cities, write a program to compute the rankings of restaurants in the cities satisfying the condition explained above.

입력
Your program is to read from standard input. The first line of input contains the integer (), representing the total number of nodes corresponding to the cities (restaurants) to be visited in the travel route graph. The nodes are numbered as to . Each of the following lines contains two integers and (), separated by a space, representing an edge connecting two nodes and of the travel route graph.
출력
The first line should contain integers , separated by spaces, where represents the ranking of city and must satisfy the condition mentioned above. Note that is an integer between and and there is no duplication among ’s. If there are multiple combinations of rankings that satisfy the condition, output any of them.