There are n kids, numbered from 1 to n, dancing in a circle around the Christmas tree. Let's enumerate them in a clockwise direction as p_1, p_2, ..., p_n (all these numbers are from 1 to n and are distinct, so p is a permutation). Let the next kid for a kid p_i be kid p_{i + 1} if i < n and p_1 otherwise. After the dance, each kid remembered two kids: the next kid (let's call him x) and the next kid for x. Each kid told you which kids he/she remembered: the kid i remembered kids a_{i, 1} and a_{i, 2}. However, the order of a_{i, 1} and a_{i, 2} can differ from their order in the circle.

<image> Example: 5 kids in a circle, p=[3, 2, 4, 1, 5] (or any cyclic shift). The information kids remembered is: a_{1,1}=3, a_{1,2}=5; a_{2,1}=1, a_{2,2}=4; a_{3,1}=2, a_{3,2}=4; a_{4,1}=1, a_{4,2}=5; a_{5,1}=2, a_{5,2}=3.

You have to restore the order of the kids in the circle using this information. If there are several answers, you may print any. It is guaranteed that at least one solution exists.

If you are Python programmer, consider using PyPy instead of Python when you submit your code.

Input

The first line of the input contains one integer n (3 ≤ n ≤ 2 ⋅ 10^5) — the number of the kids.

The next n lines contain 2 integers each. The i-th line contains two integers a_{i, 1} and a_{i, 2} (1 ≤ a_{i, 1}, a_{i, 2} ≤ n, a_{i, 1} ≠ a_{i, 2}) — the kids the i-th kid remembered, given in arbitrary order.

Output

Print n integers p_1, p_2, ..., p_n — permutation of integers from 1 to n, which corresponds to the order of kids in the circle. If there are several answers, you may print any (for example, it doesn't matter which kid is the first in the circle). It is guaranteed that at least one solution exists.

Examples

Input


5
3 5
1 4
2 4
1 5
2 3


Output


3 2 4 1 5 


Input


3
2 3
3 1
1 2


Output


3 1 2 

/**
 * Date: 27 Dec, 2018
 * Link:
 *
 * @author Prasad-Chaudhari
 * @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/
 * @git: https://github.com/Prasad-Chaudhari
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Stack;
import org.w3c.dom.css.Counter;

public class newProgram7 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        int n = in.ni();
        int from[] = new int[n];
        int to[] = new int[n];
        int count[] = new int[n + 1];
        for (int i = 0; i < n; i++) {
            from[i] = in.ni();
            to[i] = in.ni();
            count[from[i]]++;
            count[to[i]]++;
        }
        int adja[][] = new int[n + 1][];
        for (int i = 0; i <= n; i++) {
            adja[i] = new int[count[i]];
        }
        for (int i = 0; i < n; i++) {
            adja[from[i]][--count[from[i]]] = to[i];
            adja[to[i]][--count[to[i]]] = from[i];
        }
//        for (int i = 1; i <= n; i++) {
//            System.out.print(i + ":");
//            for (int j : adja[i]) {
//                System.out.print(j + " ");
//            }
//            System.out.println("");
//        }
        boolean b[] = new boolean[n + 1];
        Stack<Integer> st = new Stack<>();
        st.push(1);
        b[1] = true;
        LinkedList<Integer> l = new LinkedList<>();
        while (!st.isEmpty()) {
            int root = st.pop();
            l.add(root);
            for (int i : adja[root]) {
                if (!b[i]) {
                    b[i] = true;
                    st.push(i);
                }
            }
        }
        if (n != 3) {
            if (l.get(1) == from[0] || l.get(1) == to[0]) {
                while (!l.isEmpty()) {
                    System.out.println(l.removeFirst());
                }
            } else {
                while (!l.isEmpty()) {
                    System.out.println(l.removeLast());
                }
            }
        } else {
            if (l.get(1) == from[0] || l.get(1) == to[0]) {
                if (l.get(2) == from[1] || l.get(2) == to[1]) {
                    if (l.get(0) == from[2] || l.get(0) == to[2]) {
                        while (!l.isEmpty()) {
                            System.out.println(l.removeFirst());
                        }
                        return;
                    }
                }
            }
            while (!l.isEmpty()) {
                System.out.println(l.removeLast());
            }
        }
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;
        private StringBuilder sb;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            sb = new StringBuilder();
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = nl();
            }
            return a;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }

    static class Data implements Comparable<Data> {

        int a, b;

        public Data(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Data o) {
            if (a == o.a) {
                return Integer.compare(b, o.b);
            }
            return Integer.compare(a, o.a);
        }

        public static void sort(int a[]) {
            Data d[] = new Data[a.length];
            for (int i = 0; i < a.length; i++) {
                d[i] = new Data(a[i], 0);
            }
            Arrays.sort(d);
            for (int i = 0; i < a.length; i++) {
                a[i] = d[i].a;
            }
        }
    }
}
