#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
template<class T>void cxk(T&a,T b){a=a>b?a:b;}
template<class T>void cnk(T&a,T b){a=a<b?a:b;}
#ifdef mod
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod;y>>=1;
	}
	return ret;
}
template<class Ta,class Tb>void inc(Ta&a,Tb b){a=a+b>=mod?a+b-mod:a+b;}
template<class Ta,class Tb>void dec(Ta&a,Tb b){a=a>=b?a-b:a+mod-b;}
#endif
int fir[100010],dis[200010],nxt[200010],id;
void link(int a,int b){nxt[++id]=fir[a],fir[a]=id,dis[id]=b;}
int dist[100010],rt,fa[100010],num[100010],cnt[100010];
void dfs(int x){
	if(dist[x]>dist[rt])rt=x;
	for(int i=fir[x];i;i=nxt[i]){
		if(dis[i]==fa[x])continue;
		dist[dis[i]]=dist[x]+1;fa[dis[i]]=x;
		dfs(dis[i]);
	}
}
int p1[100010],p2[100010];
int main(){
#ifdef LOCAL
	freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
#endif
	int n=gi(),a,b,m=0;
	for(int i=1;i<n;++i)a=gi(),b=gi(),link(a,b),link(b,a);
	dist[1]=0,dfs(1);
	a=rt;memset(fa,0,sizeof fa);
	dist[rt]=0,dfs(rt),b=rt;
	for(int i=b;i;i=fa[i])num[i]=++m,cnt[m]=1;
	for(int i=1;i<=n;++i)
		if(!num[i]){
			bool flg=0;
			for(int j=fir[i];j;j=nxt[j])
				if(num[dis[j]]){flg=1;++cnt[num[dis[j]]];break;}
			if(!flg)puts("-1"),exit(0);
		}
	auto get=[&](int*p){
		int now=0,len=0;
		for(int i=1;i<=m;++i){
			for(int j=2;j<=cnt[i];++j)p[++len]=j+now;
			p[++len]=now+1;now+=cnt[i];
		}
	};
	get(p1);
	std::reverse(cnt+1,cnt+m+1);
	get(p2);
	bool flg=0;
	for(int i=1;i<=n;++i)
		if(p1[i]<p2[i]){flg=1;break;}
		else if(p1[i]>p2[i]){flg=0;break;}
	if(!flg)std::swap(p1,p2);
	for(int i=1;i<=n;++i)printf("%d ",p1[i]);
	return 0;
}


### Prompt

Your challenge is to write a CPP solution to the following problem:

Takahashi has an ability to generate a tree using a permutation (p_1,p_2,...,p_n) of (1,2,...,n), in the following process:

First, prepare Vertex 1, Vertex 2, ..., Vertex N. For each i=1,2,...,n, perform the following operation:

* If p_i = 1, do nothing.
* If p_i \neq 1, let j' be the largest j such that p_j < p_i. Span an edge between Vertex i and Vertex j'.



Takahashi is trying to make his favorite tree with this ability. His favorite tree has n vertices from Vertex 1 through Vertex n, and its i-th edge connects Vertex v_i and w_i. Determine if he can make a tree isomorphic to his favorite tree by using a proper permutation. If he can do so, find the lexicographically smallest such permutation.

Constraints

* 2 \leq n \leq 10^5
* 1 \leq v_i, w_i \leq n
* The given graph is a tree.

Input

Input is given from Standard Input in the following format:


n
v_1 w_1
v_2 w_2
:
v_{n-1} w_{n-1}


Output

If there is no permutation that can generate a tree isomorphic to Takahashi's favorite tree, print `-1`. If it exists, print the lexicographically smallest such permutation, with spaces in between.

Examples

Input

6
1 2
1 3
1 4
1 5
5 6


Output

1 2 4 5 3 6


Input

6
1 2
2 3
3 4
1 5
5 6


Output

1 2 3 4 5 6


Input

15
1 2
1 3
2 4
2 5
3 6
3 7
4 8
4 9
5 10
5 11
6 12
6 13
7 14
7 15


Output

-1

### Response

```cpp
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
template<class T>void cxk(T&a,T b){a=a>b?a:b;}
template<class T>void cnk(T&a,T b){a=a<b?a:b;}
#ifdef mod
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod;y>>=1;
	}
	return ret;
}
template<class Ta,class Tb>void inc(Ta&a,Tb b){a=a+b>=mod?a+b-mod:a+b;}
template<class Ta,class Tb>void dec(Ta&a,Tb b){a=a>=b?a-b:a+mod-b;}
#endif
int fir[100010],dis[200010],nxt[200010],id;
void link(int a,int b){nxt[++id]=fir[a],fir[a]=id,dis[id]=b;}
int dist[100010],rt,fa[100010],num[100010],cnt[100010];
void dfs(int x){
	if(dist[x]>dist[rt])rt=x;
	for(int i=fir[x];i;i=nxt[i]){
		if(dis[i]==fa[x])continue;
		dist[dis[i]]=dist[x]+1;fa[dis[i]]=x;
		dfs(dis[i]);
	}
}
int p1[100010],p2[100010];
int main(){
#ifdef LOCAL
	freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
#endif
	int n=gi(),a,b,m=0;
	for(int i=1;i<n;++i)a=gi(),b=gi(),link(a,b),link(b,a);
	dist[1]=0,dfs(1);
	a=rt;memset(fa,0,sizeof fa);
	dist[rt]=0,dfs(rt),b=rt;
	for(int i=b;i;i=fa[i])num[i]=++m,cnt[m]=1;
	for(int i=1;i<=n;++i)
		if(!num[i]){
			bool flg=0;
			for(int j=fir[i];j;j=nxt[j])
				if(num[dis[j]]){flg=1;++cnt[num[dis[j]]];break;}
			if(!flg)puts("-1"),exit(0);
		}
	auto get=[&](int*p){
		int now=0,len=0;
		for(int i=1;i<=m;++i){
			for(int j=2;j<=cnt[i];++j)p[++len]=j+now;
			p[++len]=now+1;now+=cnt[i];
		}
	};
	get(p1);
	std::reverse(cnt+1,cnt+m+1);
	get(p2);
	bool flg=0;
	for(int i=1;i<=n;++i)
		if(p1[i]<p2[i]){flg=1;break;}
		else if(p1[i]>p2[i]){flg=0;break;}
	if(!flg)std::swap(p1,p2);
	for(int i=1;i<=n;++i)printf("%d ",p1[i]);
	return 0;
}


```