#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int n;
vector<int> g[100010];
ll d[100010];
bool f[100010];

void dfs(int v,int pre,int dep){
  d[v]=dep;
  for(int nv : g[v]){
    if(nv==pre)continue;
    dfs(nv,v,dep+1);
  }
}

int main(){
  cin>>n;
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(0,-1,0);
  int s=0;
  rep(i,n)if(d[i]>d[s])s=i;
  dfs(s,-1,0);
  int t=0;
  rep(i,n)if(d[i]>d[t])t=i;

  vector<int> vs;
  {
    int v=t;
    vs.push_back(t);
    f[v]=true;
    while(v!=s){
      for(int nv : g[v]){
        if(d[nv]+1==d[v]){
          v=nv;
          break;
        }
      }
      f[v]=true;
      vs.push_back(v);
    }
  }

  vector<int> c(vs.size(),0),rc;

  repl(i,1,vs.size()-1){
    int v=vs[i];
    for(int nv : g[v]){
      if(f[nv])continue;
      if(g[nv].size()>=2){
        cout<<-1<<endl;
        return 0;
      }
      c[i]++;
    }
  }
  rc=c;
  reverse(all(rc));
  minch(c,rc);

  int v=1;
  rep(i,vs.size()){
    int sav=v;
    v++;
    rep(j,c[i])cout<<v++<<" ";
    cout<<sav<<" ";
  }
  cout<<endl;

  return 0;
}

### Prompt

Please create a solution in Cpp 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>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int n;
vector<int> g[100010];
ll d[100010];
bool f[100010];

void dfs(int v,int pre,int dep){
  d[v]=dep;
  for(int nv : g[v]){
    if(nv==pre)continue;
    dfs(nv,v,dep+1);
  }
}

int main(){
  cin>>n;
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(0,-1,0);
  int s=0;
  rep(i,n)if(d[i]>d[s])s=i;
  dfs(s,-1,0);
  int t=0;
  rep(i,n)if(d[i]>d[t])t=i;

  vector<int> vs;
  {
    int v=t;
    vs.push_back(t);
    f[v]=true;
    while(v!=s){
      for(int nv : g[v]){
        if(d[nv]+1==d[v]){
          v=nv;
          break;
        }
      }
      f[v]=true;
      vs.push_back(v);
    }
  }

  vector<int> c(vs.size(),0),rc;

  repl(i,1,vs.size()-1){
    int v=vs[i];
    for(int nv : g[v]){
      if(f[nv])continue;
      if(g[nv].size()>=2){
        cout<<-1<<endl;
        return 0;
      }
      c[i]++;
    }
  }
  rc=c;
  reverse(all(rc));
  minch(c,rc);

  int v=1;
  rep(i,vs.size()){
    int sav=v;
    v++;
    rep(j,c[i])cout<<v++<<" ";
    cout<<sav<<" ";
  }
  cout<<endl;

  return 0;
}

```