#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

long long  mod = 1000000007;

class TreeDiameter
{
public:
    vector<vector<int> > G;
    vector<int> diameter;
    int V;
    TreeDiameter(int node_size){
        V = node_size;
        G.resize(V);
    }
    void add_edge(int u,int v){
        G[u].push_back(v),G[v].push_back(u);
    }
    void dfs(int u,int p,int d,int& far,int& mx){
        if(mx < d){
            far = u;
            mx = d;
        }
        for(int v : G[u]){
            if(v != p){
                dfs(v,u,d+1,far,mx);
            }
        }
    }
    bool redfs(int u,int p,const int t){
        if(u == t){
            return true;
        }
        for(int v : G[u]){
            if(v != p){
                diameter.push_back(v);
                if(redfs(v,u,t)){
                    return true;
                }else{
                    diameter.pop_back();
                }
            }
        }
        return false;
    }
    void solve(){
        int s,t,mx;
        mx = -1;
        dfs(0,-1,0,s,mx);
        mx = -1;
        dfs(s,-1,0,t,mx);
        diameter.push_back(s);
        redfs(s,-1,t);
    }
};

vector<int> ans1,ans2;   
bool flag = 0;

int main(){
    int n;
    cin >> n;
    TreeDiameter tr(n);
    vector<vector<int> > g(n);
    vector<int> s(n);
    for(int i=0;i<n-1;i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        tr.add_edge(a,b);
        s[a]++;
        s[b]++;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    tr.solve();
    vector<int>p = tr.diameter;
    int tmp = 1;
    for(int i=0;i<p.size();i++){
        if(i==0){
            ans1.PB(1);
            tmp++;
        }else if(i==p.size()-1){
            ans1.PB(n);
        }else{
            int k = s[p[i]];
            for(int j=tmp+1;j<=tmp+k-2;j++){
                ans1.PB(j);
            }
            ans1.PB(tmp);
            tmp += k-1;
        }
    }
    if(ans1.size()!=n){
        cout << -1 << endl;
        return 0;
    }
    reverse(p.begin(),p.end());
    tmp = 1;
    for(int i=0;i<p.size();i++){
        if(i==0){
            ans2.PB(1);
            tmp++;
        }else if(i==p.size()-1){
            ans2.PB(n);
        }else{
            int k = s[p[i]];
            for(int j=tmp+1;j<=tmp+k-2;j++){
                ans2.PB(j);
            }
            ans2.PB(tmp);
            tmp += k-1;
        }
    }
    bool flag = 1;
    rep(i,n){
        if(ans1[i]==ans2[i])continue;
        if(ans1[i]>ans2[i]){
            flag = 0;
            break;
        }else{
            flag = 1;
            break;
        }
    }
    if(flag){
        for(int i=0;i<ans1.size();i++){
            cout << ans1[i] << " ";
        }
        cout << endl;
    }else{
         for(int i=0;i<ans2.size();i++){
            cout << ans2[i] << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 17020