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

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef pair<ld,ld> id;
typedef tuple<ll,ll,ll> tl;
typedef tuple<ll,ll,ll,ll> ql;

#define FOR(i, a, b) for(ll i=(a); i<=(b); i++)
#define ROF(i, a, b) for(ll i=(a); i>=(b); i--)
#define MEM(x, v) memset(x, v, sizeof(x))
#define FILL(x, n, v) fill(x, x+n, v);
#define ALL(x) x.begin(), x.end()
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define f first
#define s second
#define ins insert
#define e emplace
#define eb emplace_back
#define ef emplace_front
#define p push
#define pf push_front
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ft front
#define bk back
#define pp pop
#define ppb pop_back
#define ppf pop_front

#define db cout<<"YEET\n";
#define ct(x) cout<<x<<'\n';

const ll MOD = 1e9+7; //998244353
const ll MAXN = 1e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);

vector<ll> adjlist[MAXN], stk, fin;
bool visited[MAXN];
ll maxdist, nd, nd1=1;

void dfs(ll u, ll dist){
    stk.pb(u);
    if (dist>maxdist){
        maxdist = dist;
        nd=u;
    }
    visited[u] = 1;
    for (auto v : adjlist[u]){
        if (!visited[v]) dfs(v, dist+1);
    }
    stk.ppb();
    return;
}

void dfs1(ll u, ll dist){
    stk.pb(u);
    visited[u] = 1;
    if (dist>maxdist){
        maxdist = dist;
        nd1=u;
    }
    for (auto v : adjlist[u]){
        if (!visited[v]) dfs1(v, dist+1); 
    }
    stk.ppb();
    return;
}
bool found;
void dfs2(ll u){
    stk.pb(u);
    visited[u]=1;
    if (u == nd1){
        fin=stk;
        found=1;
        return;
    }
    for (auto v : adjlist[u]){
        if (!visited[v]) dfs2(v);
        if (found) return;
    }
    stk.ppb();
    return;
}

bool imposs;

void dfschk(ll u, ll dist){
    if (dist > 1) imposs=1;
    visited[u] = 1;
    for (auto v : adjlist[u]){
        if (!visited[v]) {
            dfschk(v, dist+1);
        }
    }
    return;
}

int main(){
    FAST
    ll n;
    cin >> n;
    FOR(i,1,n-1){
        ll a, b;
        cin >> a >> b;
        adjlist[a].pb(b);
        adjlist[b].pb(a);
    }

    stk.clear();
    dfs(1, 0);
    MEM(visited, false);
    dfs1(nd, 0);
    MEM(visited, false);
    dfs2(nd);
    MEM(visited, false);

    ll sz = fin.size();
    FOR(i,0,sz-1){
        visited[fin[i]]=1;
    }
    FOR(i,0,sz-1){
        if (adjlist[fin[i]].size() > 2){
            dfschk(fin[i], 0);
            if (imposs) break;
        }
    }

    if (imposs) cout << "-1";
    else {
        vector<ll> ans1, ans2;
        ll cnt=1;
        FOR(i,0,sz-1){
            if (adjlist[fin[i]].size() > 2){
                ll extra = adjlist[fin[i]].size() - 2;
                FOR(j, cnt+1, cnt+extra) ans1.pb(j);
                ans1.pb(cnt);
                cnt += extra+1;
            } else {
                ans1.pb(cnt);
                cnt++;
            }
        }

        cnt=1;
        ROF(i,sz-1,0){
            if (adjlist[fin[i]].size() > 2){
                ll extra = adjlist[fin[i]].size() - 2;
                FOR(j, cnt+1, cnt+extra) ans2.pb(j);
                ans2.pb(cnt);
                cnt += extra+1;
            } else {
                ans2.pb(cnt);
                cnt++;
            }
        }

        if (ans1 < ans2){
            FOR(i,0,n-1){
                cout << ans1[i] << " ";
            }
        } else {
            FOR(i,0,n-1){
                cout << ans2[i] << " ";
            }
        }
    }
}

Measured memory_bytes: 15988