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.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.net.ssl.SSLContext;

public class Main
{  
   static long mod=(long)(1e+9 + 7);
   static int[] sieve;
   static ArrayList<Integer> primes;

   static class Pair
   {
	   int a;
	   int b;
   }
   
   public static void main(String[] args) throws java.lang.Exception
   {	  	
	     fast s = new fast();
	     PrintWriter out=new PrintWriter(System.out);
	     Scanner sc=new Scanner(System.in);
	     StringBuilder fans = new StringBuilder();
	     
	     int n=s.nextInt();
	
	     Pair arr[]=new Pair[n+1];
	     
	     for(int i=1;i<=n;i++)
	    	 {
	    		 arr[i]=new Pair();
	    		 arr[i].a=s.nextInt();
	    		 arr[i].b=s.nextInt();
	    	 }
	     
	     int x=arr[1].a; int y=arr[1].b;
	     int corr_x; int corr_y;
	     
	     if(arr[x].a==y || arr[x].b==y)  {corr_x=x; corr_y=y;}
	     else {corr_x=y; corr_y=x;}
	     
	     System.out.print("1 "+corr_x+" "+corr_y+" ");
	     
	     for(int i=1;i<=n-3;i++)
	    	 {
	    		 x=arr[corr_x].a;
	    		 y=arr[corr_x].b;
	    		 
	    		 if(x!=corr_y) {System.out.print(x+" ");int temp=corr_y;corr_y=x;corr_x=temp;}
	    		 else {System.out.print(y+" ");int temp=corr_y;corr_y=y;corr_x=temp;}
	    	 }	     
   }
  
   
   
static class fast {   

	private InputStream i;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		
		//Return floor log2n
		public static int log2(int bits) // returns 0 for bits=0
			{
			    int log = 0;
			    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
			    if( bits >= 256 ) { bits >>>= 8; log += 8; }
			    if( bits >= 16  ) { bits >>>= 4; log += 4; }
			    if( bits >= 4   ) { bits >>>= 2; log += 2; }
			    return log + ( bits >>> 1 );
			}
		
		public static boolean next_permutation(int a[])
		   {
			   int i=0,j=0;int index=-1;	   
			   int n=a.length;
			   
			   for(i=0;i<n-1;i++)
				   if(a[i]<a[i+1]) index=i;
			   
			   if(index==-1) return false;
			   i=index;

			  
			   for(j=i+1;j<n && a[i]<a[j];j++);

			   int temp=a[i];
			   a[i]=a[j-1];
			   a[j-1]=temp;
			   	   
			   for(int p=i+1,q=n-1;p<q;p++,q--)
			   {
				   temp=a[p];
				   a[p]=a[q];
				   a[q]=temp;
			   }
			   
			   return true;
		   }
		   
		   
		public static void division(char ch[],int divisor)
		   {
			   int div=Character.getNumericValue(ch[0]); int mul=10;int remainder=0;
			   StringBuilder quotient=new StringBuilder("");
			   for(int i=1;i<ch.length;i++)
			   {
				   div=div*mul+Character.getNumericValue(ch[i]);	
				   if(div<divisor) {quotient.append("0");continue;}
				   quotient.append(div/divisor);
				   div=div%divisor;mul=10;
				   
			   } 
			   remainder=div;
			   while(quotient.charAt(0)=='0')quotient.deleteCharAt(0);	   
			   System.out.println(quotient+" "+remainder);	  
		   }
		
		public static void sieve(int size)
		{
			sieve=new int[size+1];
			primes=new ArrayList<Integer>();
			sieve[1]=1;
			for(int i=2;i<=Math.sqrt(size);i++)
			{
				if(sieve[i]==0)
				 {
					for(int j=i*i;j<size;j+=i) sieve[j]=1;
				 }
			}
			
			for(int i=2;i<=size;i++)
			{
				if(sieve[i]==0) primes.add(i);
			}
		}
		
		public static long pow(long n, long b, long MOD)
		   {
		       long x=1;long y=n; 
		       while(b > 0)
		       {
		           if(b%2 == 1)
		           {
		               x=x*y;
		               if(x>MOD) x=x%(MOD);
		           }
		           y = y*y;
		           if(y>MOD) y=y%(MOD); 
		           b >>= 1;
		       }
		       return x;
		   }


		public static long mod_inv(long n,long mod)
		{
			return pow(n,mod-2,mod);
		}
		
		 public static int upper(Integer[] a,int start,int end,int key)
		 {
			   int mid=(start+end)>>1;
			   if(start==end && a[mid]<key) {return -1;}
			   if(start>end) return -1;

			   if(a[mid]>=key && (((mid-1)>=0 && a[mid-1]<key) || (mid-1)==0)) return mid;
			   else if(a[mid]== key && (mid-1)>=0 && a[mid-1]==key) return lower(a,start,mid-1,key);   
			   else if(key>a[mid]) return lower(a,mid+1,end,key);
			   else return lower(a,start,mid-1,key);
		}
		 
		 public static int lower(Integer a[],int start,int end,int key)
		 {
			   int mid=(start+end)>>1;
			   if(start==end && a[mid]>key) {return -1;}
			   if(start>end) return -1;

			   if(a[mid]<=key && (((mid+1)<a.length && a[mid+1]>key) || (mid+1)==a.length)) return mid;
			   else if(a[mid]== key && (mid+1)<a.length && a[mid+1]==key) return upper(a,mid+1,end,key);   
			   else if(key>=a[mid]) return upper(a,mid+1,end,key);
			   else return upper(a,start,mid-1,key);
		} 
		   
		public int gcd(int a,int b)
		{
			if(a==0) return b;
			return gcd(b%a,a);
		}
		public fast() {
			this(System.in);
		}
		public fast(InputStream is) {
			i = is;
		}
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = i.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		public String nextString() {
     		int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		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 - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}	
}