Andryusha goes through a park each day. The squares and paths between them look boring to Andryusha, so he decided to decorate them.

The park consists of *n* squares connected with (*n* - 1) bidirectional paths in such a way that any square is reachable from any other using these paths. Andryusha decided to hang a colored balloon at each of the squares. The baloons' colors are described by positive integers, starting from 1. In order to make the park varicolored, Andryusha wants to choose the colors in a special way. More precisely, he wants to use such colors that if *a*, *b* and *c* are distinct squares that *a* and *b* have a direct path between them, and *b* and *c* have a direct path between them, then balloon colors on these three squares are distinct.

Andryusha wants to use as little different colors as possible. Help him to choose the colors!
The first line contains single integer *n* (3 ≤ *n* ≤ 2·10<sup class="upper-index">5</sup>) — the number of squares in the park.

Each of the next (*n* - 1) lines contains two integers *x* and *y* (1 ≤ *x*, *y* ≤ *n*) — the indices of two squares directly connected by a path.

It is guaranteed that any square is reachable from any other using the paths.
In the first sample the park consists of three squares: 1 → 3 → 2. Thus, the balloon colors have to be distinct.

In the second example there are following triples of consequently connected squares: 
 -  1 → 3 → 2 -  1 → 3 → 4 -  1 → 3 → 5 -  2 → 3 → 4 -  2 → 3 → 5 -  4 → 3 → 5 
In the third example there are following triples: 
 -  1 → 2 → 3 -  2 → 3 → 4 -  3 → 4 → 5
3
2 3
1 3
3
1 3 2 
5
2 3
5 3
4 3
1 3
5
1 3 2 5 4 
5
2 1
3 2
4 3
5 4
3
1 2 3 1 2 
10
5 3
9 2
7 1
3 8
4 1
1 9
10 1
8 9
6 2
5
1 2 1 3 2 1 2 3 4 5 
3
2 1
3 2
3
1 2 3 
10
2 7
8 2
9 8
1 9
4 1
3 4
6 3
10 6
5 10
3
1 1 2 3 2 1 2 3 2 3 
5
4 2
3 1
3 4
3 5
4
1 1 2 3 4 
7
3 6
3 1
3 2
3 5
3 4
3 7
7
1 4 2 6 5 3 7 
10
8 6
10 5
8 4
2 7
3 8
10 3
3 9
2 1
3 2
5
1 2 4 3 1 2 3 1 5 3 
50
45 2
4 48
16 4
17 29
29 33
31 2
47 41
41 33
22 6
44 40
32 24
12 40
28 16
18 30
20 41
25 45
35 29
10 32
1 48
15 50
6 9
43 2
33 2
38 33
8 2
36 7
26 48
50 8
34 31
48 33
13 45
37 33
7 6
40 32
3 6
30 49
49 33
11 40
19 40
24 2
14 50
5 50
42 16
23 2
9 45
39 6
46 48
27 13
21 2
9
1 4 4 3 4 2 3 6 5 2 5 4 3 3 2 1 2 2 6 2 9 1 8 7 2 4 2 2 1 1 2 1 5 1 3 1 7 6 6 3 3 4 3 2 1 6 1 2 8 1 
50
8 37
40 8
38 40
10 38
29 10
33 29
17 33
25 17
19 25
3 19
13 3
24 13
12 24
5 12
41 5
11 41
27 11
45 27
6 45
35 6
9 35
50 9
32 50
21 32
22 21
1 22
31 1
28 31
4 28
30 4
7 30
48 7
46 48
16 46
49 16
39 49
18 39
14 18
34 14
23 34
20 23
15 20
44 15
42 44
2 42
36 2
43 36
26 43
47 26
3
1 3 2 1 1 2 2 2 3 2 2 2 1 1 3 2 2 2 3 1 3 2 2 3 1 3 1 2 1 3 3 1 3 3 1 2 3 3 3 1 3 1 1 2 3 3 2 1 1 2 
50
7 5
6 40
49 43
48 2
44 11
10 3
46 49
22 18
17 33
4 29
48 4
47 41
24 19
48 8
1 21
2 17
17 34
16 10
17 20
1 22
44 32
6 28
7 1
47 26
28 44
23 50
21 15
1 30
7 27
28 25
17 23
14 42
6 46
5 24
44 9
25 39
46 47
21 35
7 16
34 12
45 14
35 36
28 13
6 48
46 37
39 45
40 7
2 31
30 38
6
1 2 2 3 2 1 4 5 5 1 1 2 5 3 3 5 1 2 3 5 2 3 6 1 4 2 3 2 1 5 3 4 3 4 4 1 5 2 1 6 1 1 1 3 2 3 4 4 2 2 
def main():
  connections = {}
  visited = []
  color = {}
  max_color = 0
  to_visit = []
  k = int(input())
  parent_color = {}
  
  for i in range(k - 1):
    a, b = [int(x) for x in input().split()]
    node = a
    if a not in connections:
      connections[a] = [b]
    else:
      connections[a].append(b)
    if b not in connections:
      connections[b] = [a]
    else:
      connections[b].append(a)

  current_color = 1
  color[node] = current_color
  visited.append(node)
  for child in connections[node]:
    if child in visited:
      continue
    current_color += 1
    color[child] = current_color
    to_visit.append(child)
    parent_color[child] = 1
  while len(to_visit):
    current_node = to_visit[0]
    to_visit.pop(0)
    visited.append(current_node)

    adjacent_colors = [color[x] for x in connections[current_node] if x in color]
    new_color = 1
    for child in connections[current_node]:
      if child in visited:
        continue

      while new_color in adjacent_colors or new_color is color[current_node]:
        new_color += 1
      adjacent_colors.append(new_color)

      if new_color > max_color:
        max_color = new_color
    
      color[child] = new_color
      to_visit.append(child)
      parent_color[child] = new_color

  pstring = str(color[1])
  for i in range(2, k + 1):
    pstring += ' ' + str(color[i])
  print(pstring)
if __name__=='__main__':
  main()
