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 com.sun.org.apache.bcel.internal.generic.ARRAYLENGTH;
import java.awt.geom.*;
import java.util.*;
import java.io.*;
import java.math.*;
import java.util.regex.*;

public class Main {
       
    static InputReader in;
    
    
    public static void main(String[] args) throws IOException{        
        
        File file = new File("input.txt");
        if( file.exists() )in = new InputReader( new FileInputStream( file ) );
        else in = new InputReader( System.in );
        
        int n=in.nextInt();
        
        List<HashSet<Integer>> g=new ArrayList<>(n+1);
        for( int i=0; i<=n; i++ ) g.add( new HashSet<Integer>() );
        for( int i=0; i<2*n; i++ ){
            int u=in.nextInt();
            int v=in.nextInt();
            g.get( u ).add( v );
            g.get( v ).add( u );
        }
        
        for( int i=1; i<=n; i++ ) if( g.get(i).size()!=4 ) {
            System.out.println("-1");
            return;
        }
        List<Integer> ans, arr=new ArrayList<>();
        for( int ai : g.get( 1 ) ) arr.add( ai );
        
        for( int mask=0; mask<(1<<4); mask++ ) {
            if( Integer.bitCount( mask )!=2 ) continue;
            int a=-1, b=-1;
            for( int i=0; i<4; i++ ) {
                if( (mask&(1<<i))!=0 ) {
                    if( a==-1 ) a=arr.get(i);
                    else b=arr.get(i);
                }
            }
            ans=getIt( a , b, g, n );
            if( ans==null ) ans=getIt( b, a, g, n );
            if( ans!=null ) {
                for( int ai : ans ) System.out.print( ai + " " );
                return;
            }
        }        
        System.out.println("-1");
    } 
    
    static List<Integer> getIt( int a, int b, List<HashSet<Integer>> g, int n ) {
        List<Integer> ans=new ArrayList<>();
        boolean can=true;
        ans.add(a);
        ans.add(b);
        ans.add( 1 );
        g.get( 1 ).remove( a );
        g.get( 1 ).remove( b );
        int cur=1;
        boolean used[]=new boolean[n+1];
        used[1]=used[a]=used[b]=true;
        final int A=a, B=b;
        for( int i=1; can && i<=n-3; i++ ) {
            boolean ok=false;
            for( int next : g.get(cur) ) {
                if( !used[next] && 
                     g.get(next).contains(cur) && g.get(next).contains(b) ) {
                    ok=true;
                    b=cur;
                    cur=next;
                    ans.add(cur);
                    used[cur]=true;
                    break;
                }
            }
            if( !ok ) can=false;
        }
        g.get( 1 ).add( A );
        g.get( 1 ).add( B );
        if( can ) return ans;
        else return null;
    }
    
    
     // IO utilities:
    
    static void out( Object ...o ){ 
        System.out.println( Arrays.deepToString( o ) ); 
    } 
    
    static class InputReader {
        
        private BufferedInputStream inp;
	private int offset;
	private final int size=5120000;
        private byte buff[];
 
        InputReader( InputStream in ) throws IOException {
		inp = new BufferedInputStream( in );
                buff=new byte[size];
                offset=0;
		inp.read( buff, 0, size );
	}
        
        private void copyLeftovers() throws IOException {
            
            int j = 0;
            for ( ; offset<size; j++, offset++ ) 
                buff[j] = buff[offset];
            // and now fill the buffer
            inp.read( buff, j, size - j );
        }
 
	int nextInt() throws IOException {
            
            int parsedInt=0, by=1;
            int i=offset;
            if( buff[i]==0 ) throw new IOException(); //EOF
            // skip any non digits
            while ( i<size && ( (buff[i]<'0' || buff[i]>'9') && buff[i]!='-' ) ) i++;
            // read digits and parse number
            if( i<size && buff[i]=='-' ) {
                by=-1;
                i++;
            }
            while( i<size && buff[i]>='0' && buff[i]<='9') {
                parsedInt*=10;
                parsedInt+=buff[i]-'0';
                i++;
            }
            // check if we reached end of buffer
            if ( i==size ) {
                // copy leftovers to buffer start
		copyLeftovers();
		// and attempt to parse int again
		offset = 0;
		parsedInt = nextInt();
            } else offset=i;
            return parsedInt*by;
	}
        
        long nextLong() throws IOException{
            
            long parsedLong=0, by=1;
            int i=offset;
            if( buff[i]==0 ) throw new IOException(); //EOF
            // skip any non digits
            while ( i<size && ( (buff[i]<'0' || buff[i]>'9') && buff[i]!='-' ) ) i++;
            // read digits and parse number
            if( i<size && buff[i]=='-' ) {
                by=-1;
                i++;
            }
            while( i<size && buff[i]>='0' && buff[i]<='9') {
                parsedLong*=10L;
                parsedLong+=buff[i]-'0';
                i++;
            }
            // check if we reached end of buffer
            if ( i==size ) {
                // copy leftovers to buffer start
		copyLeftovers();
		// and attempt to parse long again
		offset = 0;
		parsedLong = nextLong();
            } else offset=i;
            return parsedLong*by;
        }
        
        double nextDouble() throws IOException{
            
            double parsedDouble=0, by=1;
            int i=offset;
            if( buff[i]==0 ) throw new IOException(); //EOF
            // skip any non digits
            while ( i<size && ( (buff[i]<'0' || buff[i]>'9') && buff[i]!='-' 
                    && buff[i]!='.' ) ) i++;
            // read digits and parse number
            if( i<size && buff[i]=='-' ) {
                by=-1;
                i++;
            }
            while( i<size && buff[i]>='0' && buff[i]<='9') {
                parsedDouble*=10;
                parsedDouble+=buff[i]-'0';
                i++;
            }
            if( i<size && buff[i]=='.' ) {
                double div=10;
                i++;
                while( i<size && buff[i]>='0' && buff[i]<='9') {
                    parsedDouble+=(buff[i]-'0')/div;
                    div*=10;
                    i++;
                }
            }
            // check if we reached end of buffer
            if ( i==size ) {
                // copy leftovers to buffer start
		copyLeftovers();
		// and attempt to parse double again
		offset = 0;
		parsedDouble=nextDouble();
            } else offset=i;
            return parsedDouble*by;
        }
        
        String next() throws IOException {
            
            StringBuilder token=new StringBuilder();
            int i=offset;
            if( buff[i]==0 ) throw new IOException(); //EOF
            // skip any non chars
            while( i<size && ( buff[i]=='\n' || buff[i]==' ' || buff[i]=='\r' ||
                    buff[i]=='\t' ) ) i++;
            // read chars
            while( i<size && buff[i]!='\n' && buff[i]!=' ' && buff[i]!='\r' &&
                    buff[i]!='\t' && buff[i]!=0 ) {
                token.append( (char)buff[i] );
                i++;
            }
            // check if we reached end of buffer
            if ( i==size ) {
                // copy leftovers to buffer start
		copyLeftovers();
		// and attempt to parse again
		offset = 0;
		return next();
            } else offset=i;
            return token.toString();
        }
        
        int[] nextInts( int n ) throws IOException {
            int arr[]=new int[n];
            for( int i=0; i<n; i++ ) arr[i]=in.nextInt();
            return arr;
        }
        
        long[] nextLongs( int n ) throws IOException {
            long arr[]=new long[n];
            for( int i=0; i<n; i++ ) arr[i]=in.nextLong();
            return arr;
        }
        
        double[] nextDoubles( int n ) throws IOException {
            double arr[]=new double[n];
            for( int i=0; i<n; i++ ) arr[i]=in.nextDouble();
            return arr;
        }
        
    }
}