#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L

#define long long long int

using std::vector;
using std::map;
using std::set;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

vector<vector<int>> g;

int n;

vector<int> solve(vector<pair<int, int>> e) {
    n = e.size() + 1;
    g.clear();
    g.resize(n);

    vector<int> d(n);
    for (int i = 0; i < n - 1; i++) {
        int x = e[i].first;
        int y = e[i].second;
//        cout << x << " " << y << "\n";
        d[x]++;
        d[y]++;
        g[x].push_back(y);
        g[y].push_back(x);
    }


    vector<int> dd = d;
    for (int i = 0; i < n; i++) {
        if (d[i] == 1) {
            for (int j : g[i]) {
                dd[j]--;
            }
        }
    }

    int s = 0;
    for (int i = 0; i < n; i++) {
        if (d[i] != 1) {
            if (dd[i] > 2) {
                return {-1};
            } else if (dd[i] < 2) {
                s = i;
            }
        }
    }
    vector<int> p;
    while (true) {
        p.push_back(s);
        bool ok = true;
        for (int i : g[s]) {
            if (d[i] > 1 && (p.size() < 2 || i != p[p.size() - 2])) {
                s = i;
                ok = false;
                break;
            }
        }
        if (ok) break;
    }

    vector<int> best = {n + 1};

    if (p.size() == 1) {
        best.clear();
        best.push_back(1);
        for (int i = 3; i < n; i++) {
            best.push_back(i);
        }
        best.push_back(2);
        best.push_back(n);
        return best;
    }

    for (int q = 0; q < 2; q++) {
        int c = 1;
        vector<int> res;
        for (int i = 0; i < p.size(); i++) {
            int v = p[i];

            int t = 1;
            for (int j : g[v]) {
                if (d[j] == 1) {
                    t++;
                }
            }
            if (i == 0) {
                res.push_back(c);
                for (int j = 0; j < t - 2; j++) {
                    res.push_back(c + 2 + j);
                }
                res.push_back(c + 1);
            } else if (i == p.size() - 1) {
                for (int j = 0; j < t - 2; j++) {
                    res.push_back(c + 1 + j);
                }
                res.push_back(c);
                res.push_back(c + t - 1);
            } else {
                for (int j = 0; j < t - 1; j++) {
                    res.push_back(c + 1 + j);
                }
                res.push_back(c);
            }
            c += t;
        }
        if (res < best) best = res;
        std::reverse(p.begin(), p.end());
    }
    return best;
}

void test(vector<int> p) {
    vector<pair<int, int>> e;
    for (int i = 0; i < n; i++) {
        if (p[i] == 0) continue;
        int j = n - 1;
        while (p[j] >= p[i]) j--;
        e.push_back({i, j});
    }
    auto res = solve(e);
    for (int i = 0; i < n; i++) {
        cout << p[i] << " ";
    }
    cout << "\n";
    for (int i = 0; i < res.size(); i++) {
        cout << " " << res[i];
    }
    cout << "\n";
}

int main() {
    std::ios::sync_with_stdio(false);

    cin >> n;
    if (n == 2) {
        cout << "1 2\n";
        return 0;
    }
    vector<pair<int, int>> e(n - 1);
    for (int i = 0; i < n - 1; i++) {
        cin >> e[i].first >> e[i].second;
        e[i].first--;
        e[i].second--;
    }
    auto res = solve(e);
    for (int i : res) {
        cout << i << " ";
    }
    cout << "\n";

//    n = 6;
//    vector<int> p = {1, 2, 3, 4, 5, 0};
//    test(p);

//
//    n = 6;
//    vector<int> p(n);
//    for (int i = 0; i < n; i++) p[i] = i;
//    while (true) {
//        test(p);
//        if (!std::next_permutation(p.begin(), p.end())) break;
//    }


    return 0;
}

Measured memory_bytes: 9840