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.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class q5 {

	 public static int gcd(int a,int b) {
		 if(b==0) return a;
		 else return gcd(b,a%b);
	 }
	 
	 // Credits to GFG
	 static long power(long x, long y, long p) 
	    { 
	        // Initialize result 
	        long res = 1;      
	         
	        // Update x if it is more   
	        // than or equal to p 
	        x = x % p;  
	      
	        while (y > 0) 
	        { 
	            // If y is odd, multiply x 
	            // with result 
	            if((y & 1)==1) 
	                res = (res * x) % p; 
	      
	            // y must be even now 
	            // y = y / 2 
	            y = y >> 1;  
	            x = (x * x) % p;  
	        } 
	        return res; 
	    } 
	 
	 
	  
	  
	
	
	 
	
	 
	 
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Reader.init(System.in);
		StringBuffer output=new StringBuffer("");
		PrintWriter out=new PrintWriter(System.out);
		int n=Reader.nextInt();
		int[][] arr=new int[n][2];
		int[] f=new int[n];
		for(int i=0;i<n;i++) {
			int x=Reader.nextInt();
			int y=Reader.nextInt();
			arr[i][0]=x;
			arr[i][1]=y;
			
		}
		f[0]=1;
		for(int i=1;i<n;i+=2) {
			int fv=arr[f[i-1]-1][0];
			int sv=arr[f[(i-1)]-1][1];
			if(arr[fv-1][0]==sv || arr[fv-1][1]==sv) {
				f[i]=fv;
				if(i+1<n) f[i+1]=sv;
			}
			else {f[i]=sv;if(i+1<n) f[i+1]=fv;}
			
		}
		for(int i:f) {
			output.append(i);output.append(" ");
		}
		out.write(output.toString());
		out.flush();
		
	}
}

 
class Node2{
	long v1;
	long v2;
	long v3;
	long v4;
	long v5;
	Node2(long a,long b,long c){
		v1=a;v2=b;v3=c;
	}
	
}

class Heap{
	int[] mylist;
	int[] mymap;
	int[] vtxmymap;
	int size;
	long[] update;
	long updatevalue;
	int[] removed;
	Heap(int[] graph){
		int l=graph.length;
		updatevalue=0;
		removed=new int[l];
		update=new long[l];
		size=l-1;
		mylist=new int[l];
		mymap=new int[l];
		vtxmymap=new int[l];
		for(int i=size;i>0;i--) {
			if(i>size/2) {
				mylist[i]=graph[i];
				mymap[i]=i;
				vtxmymap[i]=i;
			}
			else {
				mylist[i]=graph[i];
				mymap[i]=i;
				vtxmymap[i]=i;
				boolean end=false;
				int parent=i;
				while(!end) {
					int leftchild=2*parent;
					int rightchild=2*parent+1;
					if(leftchild>size) {
						end=true;
					}
					else if(rightchild>size) {
						if(mylist[leftchild]<mylist[parent]) {
							int parentNode=vtxmymap[parent];
							int childNode=vtxmymap[leftchild];
							int parentDeg=mylist[parent];
							int childDeg=mylist[leftchild];
							mylist[parent]=childDeg;
							mylist[leftchild]=parentDeg;
							mymap[parentNode]=leftchild;
							mymap[childNode]=parent;
							vtxmymap[parent]=childNode;
							vtxmymap[leftchild]=parentNode;
							parent=leftchild;
						}
						else end=true;
					}
					else {
						if(mylist[leftchild]<=mylist[rightchild]) {
							if(mylist[leftchild]<mylist[parent]) {
								int parentNode=vtxmymap[parent];
								int childNode=vtxmymap[leftchild];
								int parentDeg=mylist[parent];
								int childDeg=mylist[leftchild];
								mylist[parent]=childDeg;
								mylist[leftchild]=parentDeg;
								mymap[parentNode]=leftchild;
								mymap[childNode]=parent;
								vtxmymap[parent]=childNode;
								vtxmymap[leftchild]=parentNode;
								parent=leftchild;
							}
							else end=true;
						}
						else {
							if(mylist[rightchild]<mylist[parent]) {
								int parentNode=vtxmymap[parent];
								int childNode=vtxmymap[rightchild];
								int parentDeg=mylist[parent];
								int childDeg=mylist[rightchild];
								mylist[parent]=childDeg;
								mylist[rightchild]=parentDeg;
								mymap[parentNode]=rightchild;
								mymap[childNode]=parent;
								vtxmymap[parent]=childNode;
								vtxmymap[rightchild]=parentNode;
								parent=rightchild;
							}
							else end=true;
						}
					}
				}
			}
		}
	}
	
	void update(int child) {
		if(update[child]==updatevalue) return;
		boolean end=false;
		while(!end) {
			update[child]=updatevalue;
			int parent=child/2;
			if(parent<1) end=true;
			else {
				if(mylist[parent]>mylist[child]) {
					int parentNode=vtxmymap[parent];
					int childNode=vtxmymap[child];
					int parentDeg=mylist[parent];
					int childDeg=mylist[child];
					mylist[parent]=childDeg;
					mylist[child]=parentDeg;
					mymap[parentNode]=child;
					mymap[childNode]=parent;
					vtxmymap[parent]=childNode;
					vtxmymap[child]=parentNode;
					parent=child;
				}
				else end=true;
			}
		}
	}
	
	int peek() {
		return mylist[1];
	}
	
	int pop() {
		int toreturn=mylist[1];
		removed[vtxmymap[1]]=1;
		mylist[1]=mylist[size];
		int changedNode=vtxmymap[size];
		vtxmymap[1]=changedNode;
		mymap[changedNode]=1;
		boolean end=false;
		size--;
		if(size==0) end=true;
		int parent=1;
		while(!end) {
			int leftchild=2*parent;
			int rightchild=2*parent+1;
			if(leftchild>size) {
				end=true;
			}
			else if(rightchild>size) {
				if(mylist[leftchild]<mylist[parent]) {
					int parentNode=vtxmymap[parent];
					int childNode=vtxmymap[leftchild];
					int parentDeg=mylist[parent];
					int childDeg=mylist[leftchild];
					mylist[parent]=childDeg;
					mylist[leftchild]=parentDeg;
					mymap[parentNode]=leftchild;
					mymap[childNode]=parent;
					vtxmymap[parent]=childNode;
					vtxmymap[leftchild]=parentNode;
					parent=leftchild;
				}
				else end=true;
			}
			else {
				if(mylist[leftchild]<=mylist[rightchild]) {
					if(mylist[leftchild]<mylist[parent]) {
						int parentNode=vtxmymap[parent];
						int childNode=vtxmymap[leftchild];
						int parentDeg=mylist[parent];
						int childDeg=mylist[leftchild];
						mylist[parent]=childDeg;
						mylist[leftchild]=parentDeg;
						mymap[parentNode]=leftchild;
						mymap[childNode]=parent;
						vtxmymap[parent]=childNode;
						vtxmymap[leftchild]=parentNode;
						parent=leftchild;
					}
					else end=true;
				}
				else {
					if(mylist[rightchild]<mylist[parent]) {
						int parentNode=vtxmymap[parent];
						int childNode=vtxmymap[rightchild];
						int parentDeg=mylist[parent];
						int childDeg=mylist[rightchild];
						mylist[parent]=childDeg;
						mylist[rightchild]=parentDeg;
						mymap[parentNode]=rightchild;
						mymap[childNode]=parent;
						vtxmymap[parent]=childNode;
						vtxmymap[rightchild]=parentNode;
						parent=rightchild;
					}
					else end=true;
				}
			}
		}
		
		
		return toreturn;
	}
	
}


 
 class DisJoint {
		int[] parent;
		int[] rank;
		int[] size;
		DisJoint(int n){
			
			parent=new int[n+1];
			rank=new int[n+1];
			for(int i=0;i<=n;i++) {
				parent[i]=i;
			}
		}

		int find(int value) {
			int par=parent[value];
			if(par==value)
				return par;
			parent[value]=find(par);
			return parent[value];
		}
		
		void union(int data1,int data2) {
			int parent1=find(data1);
			int parent2=find(data2);
			if(parent1!=parent2) {
				if(rank[parent1]>=rank[parent2]) {
					parent[parent2]=parent1;
					if(rank[parent1]==rank[parent2])
						rank[parent1]++;
				}
				else {
					parent[parent1]=parent2;	
		}

		}
		}
}

 
 class Reader {
	    static BufferedReader reader;
	    static StringTokenizer tokenizer;
	 
	    /** call this method to initialize reader for InputStream */
	    static void init(InputStream input) {
	        reader = new BufferedReader(
	                     new InputStreamReader(input) );
	        tokenizer = new StringTokenizer("");
	    }
	 
	    /** get next word */
	    
	    static String next() throws IOException {
	        while ( ! tokenizer.hasMoreTokens() ) {
	            //TODO add check for eof if necessary
	            tokenizer = new StringTokenizer(
	                   reader.readLine() );
	        }
	        return tokenizer.nextToken();
	    }
	 
	    static int nextInt() throws IOException {
	        return Integer.parseInt( next() );
	    }
	    static long nextLong() throws IOException {
	        return Long.parseLong( next() );
	    }
	    static double nextDouble() throws IOException {
	        return Double.parseDouble( next() );
	    }
	}

