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 JAVA):

Solution:
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.Locale;
import java.io.OutputStream;
import java.util.RandomAccess;
import java.io.PrintWriter;
import java.util.AbstractList;
import java.io.Writer;
import java.util.List;
import java.io.IOException;
import java.util.Arrays;
import java.math.BigDecimal;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.math.BigInteger;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Jacob Jiang
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int n = in.nextInt();
        //noinspection unchecked
        List<Integer>[] map = new List[n];
        for (int i = 0; i < n; i++) {
            map[i] = new ArrayList<Integer>(4);
        }
        for (int i = 0; i < 2 * n; i++) {
            int a = in.nextInt() - 1;
            int b = in.nextInt() - 1;
            map[a].add(b);
            map[b].add(a);
        }
        for (int i = 0; i < n; i++) {
            if (map[i].size() != 4) {
                out.println(-1);
                return;
            }
            Collections.sort(map[i]);
        }
        if (n <= 6) {
            int[] p = CombinatoricsUtils.originPermutation(n);
            tag:
            do {
                for (int i = 0; i < n; i++) {
                    if (!map[p[i]].contains(p[(i + 1) % n]) || !map[p[i]].contains(p[(i + 2) % n]))
                        continue tag;
                }
                ArrayUtils.increaseByOne(p);
                out.printLine(ArrayUtils.asList(p).toArray());
                return;
            } while (CombinatoricsUtils.nextPermutation(p));
            out.println(-1);
            return;
        }
        int[] answer = new int[n];
        Arrays.fill(answer, -1);
        answer[0] = 0;
        {
            int[] ct = new int[4];
            for (int t : map[0]) {
                for (int c : map[t]) {
                    if (map[0].contains(c)) {
                        ct[map[0].indexOf(c)]++;
                    }
                }
            }
            int[] a = ct.clone();
            Arrays.sort(a);
            if (!Arrays.equals(a, new int[]{1, 1, 2, 2})) {
                out.println(-1);
                return;
            }
            for (int i = 0; i < 4; i++) {
                if (ct[i] == 2) {
                    answer[1] = map[0].get(i);
                    for (int c : map[0]) {
                        if (ct[map[0].indexOf(c)] == 1 && map[answer[1]].contains(c)) {
                            answer[2] = c;
                            break;
                        }
                    }
                    break;
                }
            }
            if (answer[1] == -1 || answer[2] == -1) {
                out.println(-1);
                return;
            }
        }
        boolean[] visited = new boolean[n];
        for (int i = 0; i < 3; i++) {
            visited[answer[i]] = true;
        }
        for (int i = 3; i < n - 1; i++) {
            List<Integer> cur = new ArrayList<Integer>(4);
            for (int c : map[answer[i - 1]]) {
                if (!visited[c]) {
                    cur.add(c);
                }
            }
            for (int c : cur) {
                if (map[answer[i - 2]].contains(c)) {
                    answer[i] = c;
                    visited[c] = true;
                    break;
                }
            }
            if (answer[i] == -1) {
                out.println(-1);
                return;
            }
        }
        for (int i = 0; i < n; i++) {
            if (!visited[i]) {
                answer[n - 1] = i;
                break;
            }
        }
        for (int i = 0; i < n; i++) {
            if (!map[answer[i]].contains(answer[(i + 1) % n]) || !map[answer[i]].contains(answer[(i + 2) % n])) {
                out.println(-1);
                return;
            }
        }
        ArrayUtils.increaseByOne(answer);
        out.printLine(ArrayUtils.asList(answer).toArray());

    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1 << 16];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c & 15;
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    }

class OutputWriter {
    private PrintWriter writer;

    public OutputWriter(OutputStream stream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void println(int i) {
        writer.println(i);
    }

    public void print(Object obj) {
        writer.print(obj);
    }

    public void println() {
        writer.println();
    }

    public void print(char c) {
        writer.print(c);
    }

    public void close() {
        writer.close();
    }

    public void printItems(Object... items) {
        for (int i = 0; i < items.length; i++) {
            if (i != 0) {
                print(' ');
            }
            print(items[i]);
        }
    }

    public void printLine(Object... items) {
        printItems(items);
        println();
    }

}

class CombinatoricsUtils {
    public static boolean nextPermutation(int[] permutation) {
        int position = -1;
        for (int i = permutation.length - 2; i >= 0; i--) {
            if (permutation[i] < permutation[i + 1]) {
                position = i;
                break;
            }
        }
        if (position == -1) {
            return false;
        }
        int newPosition = -1;
        for (int i = permutation.length - 1; i >= 0; i--) {
            if (permutation[i] > permutation[position]) {
                newPosition = i;
                break;
            }
        }
        // swap variables
        {
            int swapTempValue = permutation[position];
            permutation[position] = permutation[newPosition];
            permutation[newPosition] = swapTempValue;
        }
        int a = position + 1, b = permutation.length - 1;
        while (a < b) {
            // swap variables
            {
                int swapTempValue = permutation[a];
                permutation[a] = permutation[b];
                permutation[b] = swapTempValue;
            }
            a++;
            b--;
        }
        return true;
    }

    public static int[] originPermutation(int size) {
        int[] result = new int[size];
        for (int i = 0; i < size; i++) {
            result[i] = i;
        }
        return result;
    }

}

class ArrayUtils {



    public static void increaseByOne(int[]... arrays) {
        for (int[] array : arrays) {
            for (int i = 0; i < array.length; i++) {
                array[i]++;
            }
        }
    }



    public static List<Integer> asList(int[] array) {
        return new IntList(array);
    }


    private static class IntList extends AbstractList<Integer> implements RandomAccess {

        int[] array;

        private IntList(int[] array) {
            this.array = array;
        }

        public Integer get(int index) {
            return array[index];
        }

        public Integer set(int index, Integer element) {
            int result = array[index];
            array[index] = element;
            return result;
        }

        public int size() {
            return array.length;
        }
    }

    }