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<bits/stdc++.h>
using namespace std;

typedef long long LL;

const int N=200000;

int n;
struct side{
  int y,next;
}e[N*2+9];
int lin[N+9],cs;

void Ins(int x,int y){e[++cs].y=y;e[cs].next=lin[x];lin[x]=cs;}
void Ins2(int x,int y){Ins(x,y);Ins(y,x);}

void into(){
  scanf("%d",&n);
  for (int i=1;i<n;++i){
	int x,y;
	scanf("%d%d",&x,&y);
	Ins2(x,y);
  }
}

int a[3][N+9],ca[3];

void Get_a(){
  for (int i=1;i<=n;++i) a[i%3][++ca[i%3]]=i;
}

int d[2][N+9],cd[2];

void Dfs_d(int k,int fa,int dep){
  d[dep&1][++cd[dep&1]]=k;
  for (int i=lin[k];i;i=e[i].next)
	if (e[i].y^fa) Dfs_d(e[i].y,k,dep+1);
}

int ans[N+9];

void Get_ans(){
  if (cd[0]>cd[1]) swap(d[0],d[1]),swap(cd[0],cd[1]);
  if (ca[1]<=cd[0])
	for (int i=1;i<=cd[0];++i) ans[d[0][i]]=ca[1]?a[1][ca[1]--]:a[0][ca[0]--];
  else
	for (int i=1;i<=cd[0];++i) ans[d[0][i]]=a[0][ca[0]--];
  for (int i=1;i<=cd[1];++i) ans[d[1][i]]=ca[0]?a[0][ca[0]--]:ca[1]?a[1][ca[1]--]:a[2][ca[2]--];
}

void work(){
  Get_a();
  Dfs_d(1,0,1);
  Get_ans();
}

void outo(){
  for (int i=1;i<=n;++i)
	printf("%d ",ans[i]);
  puts("");
}

int main(){
  into();
  work();
  outo();
  return 0;
}