#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
vector<int> graph[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int a, b;
  for (int i = 0; i < 2 * n; i++) {
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (graph[i].size() != 4) {
      cout << -1;
      exit(0);
    }
  }
  vector<int> temp;
  vector<int> check(n + 1, 0);
  int done = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = i + 1; j < 4; j++) {
      int num1 = graph[1][i];
      int num2 = graph[1][j];
      int exist1 = 0, exist2 = 0;
      for (int k = 0; k < 4; k++) {
        if (graph[num1][k] == num2) {
          exist1 = 1;
        }
        if (graph[num1][k] == 1) {
          exist2 = 1;
        }
      }
      if (exist1 && exist2) {
        int count1 = 0, count2 = 0;
        int use1 = 0, use2 = 0;
        for (int k = 0; k < 4; k++) {
          if (k != i && k != j) {
            if (use1 == 0) {
              use1 = graph[1][k];
            } else {
              use2 = graph[1][k];
            }
          }
        }
        for (int k = 0; k < 4; k++) {
          if (graph[use1][k] == num1 || graph[use1][k] == num2) {
            count1++;
          }
        }
        for (int k = 0; k < 4; k++) {
          if (graph[use2][k] == num1 || graph[use2][k] == num2) {
            count2++;
          }
        }
        int see1 = 0, see2 = 0;
        for (int k = 0; k < 4; k++) {
          if (graph[use1][k] == num1) {
            see1++;
          }
        }
        for (int k = 0; k < 4; k++) {
          if (graph[use2][k] == num1) {
            see2++;
          }
        }
        if (count1 == 1 && count2 == 1) {
          temp.push_back(num1);
          temp.push_back(1);
          temp.push_back(num2);
        } else if (see1 ^ see2) {
          temp.push_back(1);
          temp.push_back(num1);
          temp.push_back(num2);
        } else {
          temp.push_back(1);
          temp.push_back(num2);
          temp.push_back(num1);
        }
        check[1] = 1;
        check[num1] = 1;
        check[num2] = 1;
        done = 1;
        goto finish;
      }
    }
  }
finish:;
  if (done == 0) {
    cout << -1;
    exit(0);
  }
  while (temp.size() < n) {
    int siz = temp.size();
    int myNum = temp[siz - 1];
    int is_it = temp[siz - 2];
    int flag = 0;
    for (int k = 0; k < 4; k++) {
      if (check[graph[myNum][k]] == 0) {
        int hero = graph[myNum][k];
        for (int m = 0; m < 4; m++) {
          if (graph[hero][m] == is_it) {
            temp.push_back(hero);
            check[hero] = 1;
            flag = 1;
            goto again;
          }
        }
      }
    }
  again:;
    if (!flag) {
      cout << -1;
      exit(0);
    }
  }
  for (int i = 0; i < n; i++) {
    cout << temp[i] << " ";
  }
}
