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 
import java.io.*;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class D {
    static class FastWriter {
        private final BufferedWriter bw;

        public FastWriter() {
            this.bw = new BufferedWriter(new OutputStreamWriter(System.out));
        }

        public void print(Object object) throws IOException {
            bw.append("" + object);
        }

        public void println(Object object) throws IOException {
            print(object);
            bw.append("\n");
        }

        public void close() throws IOException {
            bw.close();
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        BigInteger nextBigInteger() {
            try {
                return new BigInteger(nextLine());
            } catch (NumberFormatException e) {
                throw new InputMismatchException();
            }
        }
    }

    static class pair {
        int one;
        int two;

        pair(int one, int two) {
            this.one = one;
            this.two = two;
        }
    }

    public static void main(String[] args) {
        FastReader fr = new FastReader();
        FastWriter fw = new FastWriter();
        int n = fr.nextInt();
        pair[] arr = new pair[n];
        for (int i = 0; i < arr.length; i++) arr[i] = new pair(fr.nextInt(), fr.nextInt());
        ArrayList<ArrayList<Integer>> ans = new ArrayList<>();
        ArrayList<Integer> list = new ArrayList<>();
        list.add(1);
        helper(arr, list, ans);
        for (int i = 0; i < n; i++) {
            System.out.print(ans.get(0).get(i) + " ");
        }
        System.out.println();
    }

    private static void helper(pair[] arr, ArrayList<Integer> list, ArrayList<ArrayList<Integer>> ans) {
        if (list.size() == arr.length) {
            ans.add(new ArrayList<>(list));
            return;
        }
        if (list.size() == 1) {
            list.add(arr[list.get(0) - 1].one);
            list.add(arr[list.get(0) - 1].two);
            helper(arr, list, ans);
            list.remove(list.size() - 1);
            list.remove(list.size() - 1);

            list.add(arr[list.get(0) - 1].two);
            list.add(arr[list.get(0) - 1].one);
            helper(arr, list, ans);
            list.remove(list.size() - 1);
            list.remove(list.size() - 1);
            return;
        }
        int a = list.get(list.size() - 2);
        int b = list.get(list.size() - 1);
        if (arr[a - 1].one == b) {
            list.add(arr[a - 1].two);
            helper(arr, list, ans);
            list.remove(list.size() - 1);
        } else if (arr[a - 1].two == b) {
            list.add(arr[a - 1].one);
            helper(arr, list, ans);
            list.remove(list.size() - 1);
        }
    }
}
