#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1e9+7;
const ll  longinf = 1LL<<60;
const int mod=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

vector<int> v[101010],ans[2];
int used[101010];
int calc(int x){
  if(v[x].size()==1)return 0;
  int ret=0;
  rep(i,v[x].size()){
    if((int)v[v[x][i]].size()!=1)ret++;
    }
  return ret;
  }

void dfs(int x,int k,int s){  
  used[x]=true;
  if(v[x].size()==1)return;
  int m=v[x].size();
  ans[s].push_back(k-m+1);
  rep(i,m-2){
    ans[s].push_back(k-i-1);
    }
  rep(i,m){
    if(used[v[x][i]])continue;
    dfs(v[x][i],k-m+1,s);
    }
  }

int main(){
  int n;
  cin>>n;
  rep(i,n-1){
    int x,y;
    cin>>x>>y;
    x--;y--;
    v[x].push_back(y);
    v[y].push_back(x);
    }
  if(n<=3){
    rep(i,n)cout<<i+1<<" ";
    cout<<endl;
    return 0;
    }
  vector<int> st;
  rep(i,n){
    if(calc(i)>=3){
      cout<<-1<<endl;
      return 0;
      }
    if(calc(i)==1)st.push_back(i);
    }
  rep(i,2)st.push_back(v[0][0]);
  rep(j,2){
    ans[j].push_back(n);
    rep(i,n)used[i]=false;
    dfs(st[j],n,j);
    ans[j].push_back(1);
    reverse(ans[j].begin(),ans[j].end());
    }
  int mi=0;
  rep(i,n){
    if(ans[0][i]==ans[1][i])continue;
    if(ans[0][i]<ans[1][i])break;
    if(ans[0][i]>ans[1][i]){
      mi=1;break;
      }
    }
  
  rep(i,n)cout<<ans[mi][i]<<" ";
  cout<<endl;
  return 0;
  }

### Prompt

Generate 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 <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1e9+7;
const ll  longinf = 1LL<<60;
const int mod=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

vector<int> v[101010],ans[2];
int used[101010];
int calc(int x){
  if(v[x].size()==1)return 0;
  int ret=0;
  rep(i,v[x].size()){
    if((int)v[v[x][i]].size()!=1)ret++;
    }
  return ret;
  }

void dfs(int x,int k,int s){  
  used[x]=true;
  if(v[x].size()==1)return;
  int m=v[x].size();
  ans[s].push_back(k-m+1);
  rep(i,m-2){
    ans[s].push_back(k-i-1);
    }
  rep(i,m){
    if(used[v[x][i]])continue;
    dfs(v[x][i],k-m+1,s);
    }
  }

int main(){
  int n;
  cin>>n;
  rep(i,n-1){
    int x,y;
    cin>>x>>y;
    x--;y--;
    v[x].push_back(y);
    v[y].push_back(x);
    }
  if(n<=3){
    rep(i,n)cout<<i+1<<" ";
    cout<<endl;
    return 0;
    }
  vector<int> st;
  rep(i,n){
    if(calc(i)>=3){
      cout<<-1<<endl;
      return 0;
      }
    if(calc(i)==1)st.push_back(i);
    }
  rep(i,2)st.push_back(v[0][0]);
  rep(j,2){
    ans[j].push_back(n);
    rep(i,n)used[i]=false;
    dfs(st[j],n,j);
    ans[j].push_back(1);
    reverse(ans[j].begin(),ans[j].end());
    }
  int mi=0;
  rep(i,n){
    if(ans[0][i]==ans[1][i])continue;
    if(ans[0][i]<ans[1][i])break;
    if(ans[0][i]>ans[1][i]){
      mi=1;break;
      }
    }
  
  rep(i,n)cout<<ans[mi][i]<<" ";
  cout<<endl;
  return 0;
  }

```