#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <cassert>
#include <cmath>
#include <deque>
using namespace std;

vector<int> DiameterPath(const vector<vector<int>> &g) {
        int n = g.size();
        if (n == 1) return vector<int> { 0 };
        //find the farthest point from the start
        auto farthest = [&](int start) {
                vector<int> depth(n);
                function<void (int, int, int)> get_depth = [&](int u, int prev, int d) {
                        depth[u] = d;
                        for (auto v : g[u]) if (v != prev) {
                                get_depth(v, u, d + 1);
                        }
                };
                get_depth(start, -1, 0);
                int maxd = 0;
                int res = 0;
                for (int i = 0; i < n; i ++) {
                        if (depth[i] > maxd) {
                                maxd = depth[i];
                                res = i;
                        }
                }
                return res;
        };
        //get end points
        int s = farthest(0);
        int t = farthest(s);
        //construct a diameter path
        vector<int> diameter_path;
        function<void (int, int, vector<int> &)> construct = [&](int u, int prev, vector<int> &path) {
                if (u == t) {
                        diameter_path = path;
                        return;
                }
                for (auto v : g[u]) if (v != prev) {
                        path.push_back(v);
                        construct(v, u, path);
                        path.pop_back();
                }
        };
        vector<int> tmp;
        tmp.push_back(s);
        construct(s, -1, tmp);
        return diameter_path;
}

vector<int> get(const vector<vector<int>> &g, const vector<int> &path) {
        vector<int> res;
        res.push_back(0);
        int cur = 1;
        res.push_back(cur);
        cur ++;
        for (int i = 1; i < (int) path.size() - 1; i ++) {
                int cnt = (int) g[path[i]].size() - 2;
                int tmp = res.back();
                res.pop_back();
                while (cnt > 0) {
                        res.push_back(cur);
                        cur ++;
                        cnt --;
                }
                res.push_back(tmp);
                res.push_back(cur);
                cur ++;
        }
        res.push_back((int) g.size() - 1);
        return res;
}

int main() {
        int n;
        scanf("%d", &n);
        vector<vector<int>> g(n);
        for (int i = 0; i < n - 1; i ++) {
                int a, b;
                scanf("%d %d", &a, &b);
                a --, b --;
                g[a].push_back(b);
                g[b].push_back(a);
        }
        auto path = DiameterPath(g);
        bool ok = true;
        for (int i = 1; i < (int) path.size() - 1; i ++) {
                int u = path[i];
                for (auto v : g[u]) if (v != path[i - 1] && v != path[i + 1]) {
                        ok = ok && ((int) g[v].size() <= 1);
                }
        }
        if (!ok) {
                printf("-1\n");
                return 0;
        }
        vector<int> ans1 = get(g, path);
        reverse(path.begin(), path.end());
        vector<int> ans2 = get(g, path);
        vector<int> ans = min(ans1, ans2);
        for (int i = 0; i < n; i ++) {
                printf("%d%c", ans[i] + 1, i == n - 1 ? '\n' : ' ');
        }
        return 0;
}



Measured memory_bytes: 15728