Problem: One day Vasya came up to the blackboard and wrote out n distinct integers from 1 to n in some order in a circle. Then he drew arcs to join the pairs of integers (a, b) (a ≠ b), that are either each other's immediate neighbors in the circle, or there is number c, such that a and с are immediate neighbors, and b and c are immediate neighbors. As you can easily deduce, in the end Vasya drew 2·n arcs.

For example, if the numbers are written in the circle in the order 1, 2, 3, 4, 5 (in the clockwise direction), then the arcs will join pairs of integers (1, 2), (2, 3), (3, 4), (4, 5), (5, 1), (1, 3), (2, 4), (3, 5), (4, 1) and (5, 2).

Much time has passed ever since, the numbers we wiped off the blackboard long ago, but recently Vasya has found a piece of paper with 2·n written pairs of integers that were joined with the arcs on the board. Vasya asks you to find the order of numbers in the circle by these pairs.

Input

The first line of the input contains a single integer n (5 ≤ n ≤ 105) that shows, how many numbers were written on the board. Next 2·n lines contain pairs of integers ai, bi (1 ≤ ai, bi ≤ n, ai ≠ bi) — the numbers that were connected by the arcs.

It is guaranteed that no pair of integers, connected by a arc, occurs in the input more than once. The pairs of numbers and the numbers in the pairs are given in the arbitrary order.

Output

If Vasya made a mistake somewhere and there isn't any way to place numbers from 1 to n on the circle according to the statement, then print a single number "-1" (without the quotes). Otherwise, print any suitable sequence of n distinct integers from 1 to n. 

If there are multiple solutions, you are allowed to print any of them. Specifically, it doesn't matter which number you write first to describe the sequence of the order. It also doesn't matter whether you write out the numbers in the clockwise or counter-clockwise direction.

Examples

Input

5
1 2
2 3
3 4
4 5
5 1
1 3
2 4
3 5
4 1
5 2


Output

1 2 3 4 5 

Input

6
5 6
4 3
5 3
2 4
6 1
3 1
6 2
2 5
1 4
3 6
1 2
4 5


Output

1 2 4 5 3 6 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using u64 = uint64_t;
using pi64 = pair<i64, i64>;
constexpr i64 MAXN = 3 * 100 * 1000 + 5LL;
constexpr i64 MOD = 1000000007LL;
constexpr i64 INF64 = MOD * MOD;
bool is_possible(const vector<i64>& perm, const i64 N,
                 const vector<vector<i64>>& adj) {
  if (perm.size() < N) {
    return false;
  }
  for (i64 i = 0; i < N; ++i) {
    for (const i64 j : vector<i64>{(i - 2 + N) % N, (i - 1 + N) % N,
                                   (i + 1) % N, (i + 2) % N}) {
      if (find(adj[perm[i]].begin(), adj[perm[i]].end(), perm[j]) ==
          adj[perm[i]].end()) {
        ;
        return false;
      }
    }
  }
  return true;
}
pi64 find_nbrs(const i64 a, const vector<vector<i64>>& adj) {
  for (i64 j = 0; j < adj[a].size(); ++j) {
    const i64 b = adj[a][j];
    for (i64 k = j + 1; k < adj[a].size(); ++k) {
      const i64 c = adj[a][k];
      if (find(adj[b].begin(), adj[b].end(), c) == adj[b].end()) {
        continue;
      };
      return make_pair(b, c);
    }
  }
  return make_pair(-1, -1);
}
vector<i64> find_nbrs(const pi64 p, const vector<vector<i64>>& adj) {
  vector<i64> isect;
  for (const i64 x : adj[p.first]) {
    if (find(adj[p.second].begin(), adj[p.second].end(), x) !=
        adj[p.second].end()) {
      isect.push_back(x);
    }
  }
  return isect;
}
void try_find_erase(vector<i64>& haystack, const i64 needle) {
  if (const auto it = find(haystack.begin(), haystack.end(), needle);
      it != haystack.end()) {
    haystack.erase(it);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  const unsigned seed = chrono::system_clock::now().time_since_epoch().count();
  mt19937 gen(seed);
  i64 N;
  cin >> N;
  ;
  vector<vector<i64>> adj(N + 1);
  for (i64 i = 0; i < 2 * N; ++i) {
    i64 A;
    cin >> A;
    ;
    i64 B;
    cin >> B;
    ;
    adj[A].push_back(B);
    adj[B].push_back(A);
  }
  const vector<vector<i64>> adj_const(adj);
  vector<i64> ans;
  for (i64 i = 1; i <= N; ++i) {
    if (adj[i].size() != 4) {
      goto done;
    }
  }
  if (N >= 7) {
    const pi64 nbrs1(find_nbrs(1, adj));
    if (nbrs1.first < 0) {
      goto done;
    }
    vector<i64> nbrs1_intersect(find_nbrs(nbrs1, adj));
    if (nbrs1_intersect.size() == 1) {
      ;
      ans.push_back(nbrs1.first);
      ans.push_back(1);
      ans.push_back(nbrs1.second);
    } else if (nbrs1_intersect.size() == 2) {
      const vector<i64> fst(find_nbrs(make_pair(1, nbrs1.first), adj));
      const vector<i64> snd(find_nbrs(make_pair(1, nbrs1.second), adj));
      ans.push_back(1);
      if (fst.size() == 1) {
        ;
        ans.push_back(nbrs1.second);
        ans.push_back(nbrs1.first);
      } else if (snd.size() == 1) {
        ;
        ans.push_back(nbrs1.first);
        ans.push_back(nbrs1.second);
      } else {
        goto done;
      }
    } else {
      goto done;
    }
    set<i64> seen(ans.begin(), ans.end());
    for (; ans.size() < N;) {
      vector<i64> nbrs(
          find_nbrs(make_pair(*prev(prev(ans.end())), ans.back()), adj));
      for (auto it = nbrs.begin(); it != nbrs.end(); ++it) {
        if (seen.count(*it)) {
          nbrs.erase(it);
          break;
        }
      };
      if (nbrs.size() != 1) {
        ans.clear();
        goto done;
      }
      ans.push_back(nbrs.front());
      seen.insert(nbrs.front());
      try_find_erase(adj[ans[ans.size() - 1]], ans[ans.size() - 3]);
      try_find_erase(adj[ans[ans.size() - 3]], ans[ans.size() - 1]);
    }
  } else {
    vector<i64> perm;
    for (i64 i = 1; i <= N; ++i) {
      perm.push_back(i);
    }
    do {
      if (is_possible(perm, N, adj)) {
        break;
      }
    } while (next_permutation(perm.begin(), perm.end()));
    ans = perm;
  }
done:
  if (!is_possible(ans, N, adj_const)) {
    ans.clear();
    cout << "-1\n";
  }
  for (i64 i = 0; i < ans.size(); ++i) {
    cout << ans[i] << " \n"[i + 1 == N];
  }
  return 0;
}