#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <map>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) { lhs = rhs; return true; }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) { lhs = rhs; return true; }
  return false;
}

struct range {
  using int_ = int_fast64_t;
  struct itr {
    int_ i;
    constexpr itr(int_ i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int_ operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int_ l_, int_ r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

struct revrange {
  using int_ = int_fast64_t;
  struct itr {
    int_ i;
    constexpr itr(int_ i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int_ operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr revrange(int_ l_, int_ r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;

constexpr i32 inf32 = (i32(1) << 30) - 1;
constexpr i64 inf64 = (i64(1) << 62) - 1;

template <class T>
class advanced_array {
public:
  struct node_type;
  using root_type = node_type *;
  using value_type = T;
  using size_type = size_t;
  using flag_type = bool;

  struct node_type {
    root_type left, right;
    value_type value;
    size_type size;
    flag_type reversed;
  };

  static uint_fast64_t engine() {
    static uint_fast64_t current = 7511168;
    current ^= (current << 9);
    current ^= (current >> 7);
    return current;
  }
  
private:
  root_type M_root;

  inline size_type size(root_type node) const {
    return node ? node -> size : 0;
  }
  inline root_type apply(root_type node) const {
    node -> size = size(node -> left) + size(node -> right) + 1;
    return node;
  }
  inline void flush(root_type node) const {
    if (node -> reversed) {
      std::swap(node -> left, node -> right);
      if (node -> left) node -> left -> reversed ^= 1;
      if (node -> right) node -> right -> reversed ^= 1;
      node -> reversed = false;
    }
  }

  root_type M_merge_impl(root_type left, root_type right) const {
    if (!left || !right) return left ? left : right;
    if (engine() % (size(left) + size(right)) < size(left)) {
      flush(left);
      left -> right = M_merge_impl(left -> right, right);
      return apply(left);
    }
    else {
      flush(right);
      right -> left = M_merge_impl(left, right -> left);
      return apply(right);
    }
  }
  std::pair<root_type, root_type> M_split_impl(root_type node, size_type pos) const {
    if (!node) return { nullptr, nullptr };
    flush(node);
    if (pos <= size(node -> left)) {
      auto tmp = M_split_impl(node -> left, pos);
      node -> left = tmp.second;
      return { tmp.first, apply(node) };
    }
    else {
      auto tmp = M_split_impl(node -> right, pos - size(node -> left) - 1);
      node -> right = tmp.first;
      return { apply(node), tmp.second };
    }
  }

  root_type M_build_impl(const std::vector<value_type> &data, size_type l, size_type r) const {
    if (l >= r) return nullptr;
    size_type idx = engine() % (r - l) + l;
    return apply(new node_type{ M_build_impl(data, l, idx), M_build_impl(data, idx + 1, r), data[idx], 1 });
  }
  void M_clear_impl(root_type node) const {
    if (!node) return;
    M_clear_impl(node -> left);
    M_clear_impl(node -> right);
    delete node;
  }
  void M_dump_impl(root_type node, std::vector<value_type> &data) const {
    if (!node) return;
    flush(node);
    M_dump_impl(node -> left, data);
    data.push_back(node -> value);
    M_dump_impl(node -> right, data);
  }

  root_type M_insert_single_impl(root_type node, size_type idx, const value_type &val) const {
    auto tmp = M_split_impl(node, idx);
    return M_merge_impl(M_merge_impl(tmp.first, new node_type{ nullptr, nullptr, val, 1, false }), tmp.second);
  }
  root_type M_insert_range_impl(root_type node, size_type idx, const std::vector<value_type> &data) const {
    auto tmp = M_split_impl(node, idx);
    return M_merge_impl(M_merge_impl(tmp.first, M_build_impl(data, 0, data.size())), tmp.second);
  }
  root_type M_erase_single_impl(root_type node, size_type idx) const {
    auto left = M_split_impl(node, idx);
    auto right = M_split_impl(left.second, 1);
    delete right.first;
    return M_merge_impl(left.first, right.second);
  }
  root_type M_erase_range_impl(root_type node, size_type l, size_type r) const {
    auto left = M_split_impl(node, l);
    auto right = M_split_impl(left.second, r - l);
    M_clear_impl(right.first);
    return M_merge_impl(left.first, right.second);
  }

public:
  advanced_array(): M_root(nullptr) { }
  advanced_array(const std::vector<value_type> &data): M_root(M_build_impl(data, 0, data.size())) { }
  ~advanced_array() { M_clear_impl(M_root); }

  void insert_at(size_type idx, const value_type &val) {
    M_root = M_insert_single_impl(M_root, idx, val);
  }
  void insert_range(size_type idx, const std::vector<value_type> &data) {
    M_root = M_insert_range_impl(M_root, idx, data);
  }
  void erase_at(size_type idx) {
    M_root = M_erase_single_impl(M_root, idx);
  }
  void erase_range(size_type l, size_type r) {
    M_root = M_erase_range_impl(M_root, l, r);
  }

  void push_front(const value_type &val) {
    M_root = M_merge_impl(new node_type{ nullptr, nullptr, val, 1, false }, M_root);
  }
  void push_back(const value_type &val) {
    M_root = M_merge_impl(M_root, new node_type{ nullptr, nullptr, val, 1, false });
  }
  void pop_front() {
    M_root = M_erase_single_impl(M_root, 0);
  }
  void pop_back() {
    M_root = M_erase_single_impl(M_root, size(M_root) - 1);
  }

  void reverse(size_type l, size_type r) {
    auto left = M_split_impl(M_root, l);
    auto right = M_split_impl(left.second, r - l);
    if (right.first) right.first -> reversed ^= 1;
    M_root = M_merge_impl(left.first, M_merge_impl(right.first, right.second));
  }
  void clear() {
    M_clear_impl(M_root);
    M_root = nullptr;
  }
  flag_type empty() const {
    return size(M_root) == 0;
  }
  size_type size() const {
    return size(M_root);
  }

  value_type &operator [] (size_type idx) {
    root_type cur = M_root;
    size_type cnt = 0;
    while (true) {
      flush(cur);
      if (cnt + size(cur -> left) == idx) return cur -> value;
      else if (cnt + size(cur -> left) > idx) cur = cur -> left;
      else cnt += size(cur -> left) + 1, cur = cur -> right;
    }
  }
  std::vector<value_type> dump(size_type l, size_type r) {
    auto left = M_split_impl(M_root, l);
    auto right = M_split_impl(left.second, r - l);
    std::vector<value_type> res;
    M_dump_impl(right.first, res);
    M_root = M_merge_impl(left.first, M_merge_impl(right.first, right.second));
    return res;
  }

};

template <class T>
struct fix_point: private T {
  explicit constexpr fix_point(T &&func): T(std::forward<T>(func)) { }
  template <class... Args>
  constexpr decltype(auto) operator () (Args &&... args) const {
    return T::operator()(*this, std::forward<Args>(args)...);
  }
};

template <class T>
constexpr decltype(auto) make_fix_point(T &&func) {
  return fix_point<T>{std::forward<T>(func)};
}

int main() {
  i32 N;
  std::cin >> N;
  if (N == 2) {
    std::cout << "1 2\n";
    return 0;
  }
  std::vector<std::vector<i32>> graph(N);
  for (auto i: range(1, N)) {
    i32 u, v;
    std::cin >> u >> v;
    --u; --v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  std::map<i32, i32> map;
  for (auto u: range(0, N)) {
    if (graph[u].size() == 1) {
      map[graph[u].front()] = u;
    }
  }
  std::vector<i32> cand;
  for (auto p: map) {
    i32 cnt = 0;
    for (auto u: graph[p.first]) {
      if (graph[u].size() > 1) {
        ++cnt;
      }
    }
    if (cnt <= 1) {
      cand.push_back(p.second);
    }
  }
  if (cand.size() >= 3) {
    std::cout << "-1\n";
    return 0;
  }
  std::vector<i32> ans(N);
  std::fill(ans.begin(), ans.end(), inf32);
  for (auto x: cand) {
    advanced_array<i32> arr;
    i32 cur = 0;
    arr.push_back(++cur);
    make_fix_point([&](auto dfs, i32 u, i32 p) -> void {
      i32 next = -1;
      for (auto v: graph[u]) {
        if (v == p) {
          continue;
        }
        if (graph[v].size() > 1) {
          next = v;
        }
        else {
          arr.insert_at(arr.size() - 1, ++cur);
        }
      }
      if (next != -1) {
        arr.push_back(++cur);
        dfs(next, u);
      }
    })(x, -1);
    std::swap(arr[arr.size() - 2], arr[arr.size() - 1]);
    chmin(ans, arr.dump(0, arr.size()));
  }
  for (auto i: range(0, N)) {
    std::cout << ans[i] << (i + 1 == N ? '\n' : ' ');
  }
  return 0;
}


Measured memory_bytes: 15204