#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <iostream>
#include <stack>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <random>
#include <chrono>
using namespace std;

int n;
const int maxn = 1e5 + 5;

vector<int> G[maxn];

int dep[2][maxn];

void dfs(int u, int fa, int d, int id){
    dep[id][u] = d;
    for(auto v : G[u]){
        if(v == fa)
            continue;
        dfs(v, u, d + 1, id);
    } 
}

pair<int, int> diameter(){
    dfs(1, 1, 0, 0);
    int mx = 1;
    for(int i = 1;i <= n;i++){
        if(dep[0][i] > dep[0][mx]){
            mx = i;
        }
    }
    dfs(mx, mx, 0, 0);
    int mx1 = mx;
    for(int i = 1;i <= n;i++){
        if(dep[0][i] > dep[0][mx1]){
            mx1 = i;
        }
    }
    dfs(mx1, mx1, 0, 1);
    return make_pair(mx, mx1);
}

int dis[maxn];

bool bfs(pair<int, int> p){
    int d = dep[0][p.second];
    memset(dis, 0x3f, sizeof(dis));
    queue<int> q;
    for(int i = 1;i <= n;i++){
        //cout << dep[0][i] << " " << dep[1][i] << endl;
        if(dep[0][i] + dep[1][i] == d){
            q.push(i);
            dis[i] = 0;
        }
    }
    while(!q.empty()){
        int u = q.front();q.pop();
        for(auto v : G[u]){
            if(dis[v] > dis[u] + 1){
                dis[v] = dis[u] + 1;
                q.push(v);
            } 
        }
    }
    for(int i = 1;i <= n;i++){
        if(dis[i] > 1)
            return false;
    }
    return true;
}

vector<int> cmp(vector<int> a, vector<int> b){
    int sz = a.size();
    for(int i = 0;i < sz;i++){
        if(a[i] == b[i])
            continue;
        else{
            if(a[i] < b[i])
                return a;
            else
                return b;
        }
    }
    return a;
}

int st[maxn];
int L[maxn];
int tot;
int tot1;
int size[maxn];

void dfs2(int u, int fa){
    size[u] = 1;
    for(auto v : G[u]){
        if(v == fa)
            continue;
        dfs2(v, u);
        size[u] += size[v];
    }
}

bool compare(int u, int v){
    return size[u] < size[v];
}

void dfs1(int u, int fa){
    L[u] = ++tot;
    sort(G[u].begin(), G[u].end(), compare);
    int num = 0;
    for(auto v : G[u]){
        if(v == fa)
            continue;
        num++;
    }
    int cur = 0;
    for(auto v : G[u]){
        if(v == fa)
            continue;
        cur++;
        if(cur < num){
            dfs1(v, u);
        }
    }
    st[++tot1] = L[u];
    cur = 0;
    for(auto v : G[u]){
        if(v == fa)
            continue;
        cur++;
        if(cur == num){
            dfs1(v, u);
        }
    }
} 

vector<int> solve(int root){
    vector<int> ret;
    tot = 0, tot1 = 0;
    dfs2(root, root);
    dfs1(root, root);
    for(int i = 1;i <= tot1;i++){
        ret.push_back(st[i]);
    }
    return ret;
}

int main(){
    cin >> n;
    for(int i = 1;i < n;i++){
        int u, v;
        scanf("%d%d", &u, &v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    pair<int, int> p = diameter();
    if(!bfs(p)){
        cout << -1 << endl;
    }else{
        vector<int> a = solve(p.first);
        vector<int> b = solve(p.second);
        vector<int> c = cmp(a, b);
        for(int i = 0;i < n;i++){
            printf("%d%c", c[i], i == n - 1 ? '\n' : ' ');
        }
    }
    return 0;
}


Measured memory_bytes: 19932