#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);


    int n;
    cin >> n;

    vector<vector<int>> graph(n);
    for (int i = 0; i + 1 < n; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }

    const int INF = 1LL << 28;
    vector<int> dis(n, 0);
    vector<int> par(n, -1);
    auto bfs = [&](int s) {
        fill(dis.begin(), dis.end(), INF);
        fill(par.begin(), par.end(), -1);
        dis[s] = 0;
        queue<int> que;
        que.push(s);

        pair<int,int> res{s, 0};
        while (!que.empty()) {
            int u = que.front();
            que.pop();
            res = make_pair(u, dis[u]);

            for (auto v : graph[u]) {
                if (dis[v] > dis[u] + 1) {
                    dis[v] = dis[u] + 1;
                    par[v] = u;
                    que.push(v);
                }
            }
        }
        return res;
    };

    int a = bfs(0).first;
    int b = bfs(a).first;

    vector<int> dia;
    {
        int cur = b;
        while (cur != -1) {
            dia.push_back(cur);
            cur = par[cur];
        }
    }


    vector<bool> in(n, false);
    auto count = [&](int u) {
        int res = 0;
        for (auto v : graph[u]) {
            if (in[v]) {
                continue;
            }
            if (graph[v].size() != 1) {
                return -1;
            }
            ++res; 
        }
        return res;
    };
    vector<int> cnts(dia.size(), 0);
    bool ok = true;
    {

        for (auto x : dia) {
            in[x] = true;
        }
        int idx = 0;
        for (auto x : dia) {
            cnts[idx] = count(x);
            if (cnts[idx] < 0) {
                ok = false;
                break;
            }
            ++idx;
        }
    }
    

    // for (int i = 0; i < dia.size(); ++i) {
    //     cout << dia[i] << " " << cnts[i] << endl;
    // }
    if (!ok) {
        cout << -1 << '\n';
        return 0;
    }

    auto gen = [&]() {
        int m = dia.size();

        vector<int> res(n, 0);
        iota(res.begin(), res.end(), 0);
        for (int i = 0, j = 0; i < m; ++i, ++j) {
            if (cnts[i] > 0) {
                reverse(res.begin() + j, res.begin() + j + cnts[i] + 1);
                reverse(res.begin() + j, res.begin() + j + cnts[i]);
                j += cnts[i];
            }
        }
        return res;
    };

    vector<int> res(n, n);

    for (int i = 0; i < 2; ++i) {
        res = min(res, gen());
        reverse(cnts.begin(), cnts.end());
    }

    for (int i = 0; i < n; ++i) {
        cout << res[i] + 1 << (i == n - 1 ? '\n' : ' ');
    }

    return 0;
}

Measured memory_bytes: 8688