#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vvi g;
vi a,b;

P dfs(int v,int d,int w){
	P p={d,v};
	for(auto u:g[v]) if(u!=w) p=max(p,dfs(u,d+1,v));
	return p;
}

bool DFS(int v,int w,int p){
	bool B=0;
	if(v==w) B=1;
	for(auto u:g[v]) if(u!=p){
		B|=DFS(u,w,v);
	}
	if(B) a.push_back(v),b[v]++;
	return B;
}

vi f(){
	vi c,num;
	int cnt=1;
	for(auto v:a){
		int t=0;
		for(auto u:g[v]) if(!b[u]) t++;
		num.push_back(t);
		for(int j=0;j<t;j++) c.push_back(cnt+j+1);
		c.push_back(cnt);
		cnt+=t+1;
	}
	if(num.back()) swap(c[n-2],c[n-1]);
	reverse(a.begin(),a.end());
	return c;
}

int main(){
	cin>>n;
	g=vvi(n);
	b=vi(n);
	for(int i=1;i<n;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	int L=dfs(0,0,-1).second,R=dfs(L,0,-1).second;
	DFS(L,R,-1);
	for(auto v:a){
		for(auto u:g[v]) if(!b[u]&&g[u].size()>1){
			cout<<-1<<endl;
			return 0;
		}
	}
	vi l=f(),r=f();
	for(int i=0;i<n;i++){
		if(l[i]<r[i]){
			break;
		}
		if(l[i]>r[i]){
			swap(l,r);
			break;
		}
	}
	for(int i=0;i<n;i++) cout<<l[i]<<" \n"[i==n-1];
}
### Prompt

Your task is to create 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>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vvi g;
vi a,b;

P dfs(int v,int d,int w){
	P p={d,v};
	for(auto u:g[v]) if(u!=w) p=max(p,dfs(u,d+1,v));
	return p;
}

bool DFS(int v,int w,int p){
	bool B=0;
	if(v==w) B=1;
	for(auto u:g[v]) if(u!=p){
		B|=DFS(u,w,v);
	}
	if(B) a.push_back(v),b[v]++;
	return B;
}

vi f(){
	vi c,num;
	int cnt=1;
	for(auto v:a){
		int t=0;
		for(auto u:g[v]) if(!b[u]) t++;
		num.push_back(t);
		for(int j=0;j<t;j++) c.push_back(cnt+j+1);
		c.push_back(cnt);
		cnt+=t+1;
	}
	if(num.back()) swap(c[n-2],c[n-1]);
	reverse(a.begin(),a.end());
	return c;
}

int main(){
	cin>>n;
	g=vvi(n);
	b=vi(n);
	for(int i=1;i<n;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	int L=dfs(0,0,-1).second,R=dfs(L,0,-1).second;
	DFS(L,R,-1);
	for(auto v:a){
		for(auto u:g[v]) if(!b[u]&&g[u].size()>1){
			cout<<-1<<endl;
			return 0;
		}
	}
	vi l=f(),r=f();
	for(int i=0;i<n;i++){
		if(l[i]<r[i]){
			break;
		}
		if(l[i]>r[i]){
			swap(l,r);
			break;
		}
	}
	for(int i=0;i<n;i++) cout<<l[i]<<" \n"[i==n-1];
}
```