Problem: We have a tree with N vertices. The vertices are numbered 1 to N, and the i-th edge connects Vertex a_i and Vertex b_i.

Takahashi loves the number 3. He is seeking a permutation p_1, p_2, \ldots , p_N of integers from 1 to N satisfying the following condition:

* For every pair of vertices (i, j), if the distance between Vertex i and Vertex j is 3, the sum or product of p_i and p_j is a multiple of 3.



Here the distance between Vertex i and Vertex j is the number of edges contained in the shortest path from Vertex i to Vertex j.

Help Takahashi by finding a permutation that satisfies the condition.

Constraints

* 2\leq N\leq 2\times 10^5
* 1\leq a_i, b_i \leq N
* The given graph is a tree.

Input

Input is given from Standard Input in the following format:


N
a_1 b_1
a_2 b_2
\vdots
a_{N-1} b_{N-1}


Output

If no permutation satisfies the condition, print `-1`.

Otherwise, print a permutation satisfying the condition, with space in between. If there are multiple solutions, you can print any of them.

Example

Input

5
1 2
1 3
3 4
3 5


Output

1 2 5 4 3

Solution (in CPP):

Solution:
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
//#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
int n;
vector<int>t[234567];
int color[234567];
void f(int p) {
	for (int a : t[p])if (color[a] == mod) {
		color[a] = (color[p] + 1) % 2;
		f(a);
	}
}
signed main() {
	cin >> n;
	for1(i, n)color[i] = mod;
	for1(i, n - 1) {
		int a, b; cin >> a >> b;
		t[a].push_back(b);
		t[b].push_back(a);
	}
	color[1] = 0;
	f(1);
	int cnt0 = 0, cnt1 = 0;
	for1(i, n)if (color[i] == 0)cnt0++; else cnt1++;
	if (cnt0 < cnt1) {
		swap(cnt0, cnt1);
		for1(i, n) {
			color[i]++;
			color[i] %= 2;
		}
	}//cnt0>=cnt1
	if (cnt1 >= (n + 1) / 3) {
		int p1 = 1, p2 = 2, p3 = 3;
		for1(i, n) {
			if (color[i] == 0) {
				if (p1 > n) {
					cout << p3; p3 += 3;
				}
				else {
					cout << p1; p1 += 3;
				}
			}
			else {
				if (p2 > n) {
					cout << p3; p3 += 3;
				}
				else {
					cout << p2; p2 += 3;
				}
			}
			cout << (i < n ? ' ' : '\n');
		}
	}
	else {
		int p = 1, p3 = 3;
		for1(i, n) {
			if (color[i] == 1) {
				cout << p3;
				p3 += 3;
			}
			else {
				cout << p++;
				if (p % 3 == 0 && p / 3 <= cnt1)p++;
			}
			cout << (i < n ? ' ' : '\n');
		}
	}
}