class Main
{
	public static void main( String[] args )
	{
		java.util.Scanner sc = new java.util.Scanner( System.in );
		
		int[] street = new int[sc.nextInt()+1];
		int   n = sc.nextInt();
		
		for( int w = 1 ; w < street.length ; w++ )
			street[w] = w;
			
		String in;
		String[] sp;
		int work = 0;
		int change1 = 0;
		int change2 = 0;
		for( int i = 0 ; i < n ; i++ )
		{
			in = sc.next();
			sp = in.split( "," );
			change1 = Integer.parseInt(sp[0]);
			change2 = Integer.parseInt(sp[1]);
			
			work = street[change1];
			street[change1] = street[change2];
			street[change2] = work;
		}
		for( int w = 1 ; w < street.length ; w++ )
			System.out.println( street[w] );
	}
} class Main
{
	public static void main( String[] args )
	{
		java.util.Scanner sc = new java.util.Scanner( System.in );
		
		int[] street = new int[sc.nextInt()+1];
		int   n = sc.nextInt();
		
		for( int w = 1 ; w < street.length ; w++ )
			street[w] = w;
			
		String in;
		String[] sp;
		int work = 0;
		int change1 = 0;
		int change2 = 0;
		for( int i = 0 ; i < n ; i++ )
		{
			in = sc.next();
			sp = in.split( "," );
			change1 = Integer.parseInt(sp[0]);
			change2 = Integer.parseInt(sp[1]);
			
			work = street[change1];
			street[change1] = street[change2];
			street[change2] = work;
		}
		for( int w = 1 ; w < street.length ; w++ )
			System.out.println( street[w] );
	}
} Main public static void main( String[] args )
	{
		java.util.Scanner sc = new java.util.Scanner( System.in );
		
		int[] street = new int[sc.nextInt()+1];
		int   n = sc.nextInt();
		
		for( int w = 1 ; w < street.length ; w++ )
			street[w] = w;
			
		String in;
		String[] sp;
		int work = 0;
		int change1 = 0;
		int change2 = 0;
		for( int i = 0 ; i < n ; i++ )
		{
			in = sc.next();
			sp = in.split( "," );
			change1 = Integer.parseInt(sp[0]);
			change2 = Integer.parseInt(sp[1]);
			
			work = street[change1];
			street[change1] = street[change2];
			street[change2] = work;
		}
		for( int w = 1 ; w < street.length ; w++ )
			System.out.println( street[w] );
	} main {
		java.util.Scanner sc = new java.util.Scanner( System.in );
		
		int[] street = new int[sc.nextInt()+1];
		int   n = sc.nextInt();
		
		for( int w = 1 ; w < street.length ; w++ )
			street[w] = w;
			
		String in;
		String[] sp;
		int work = 0;
		int change1 = 0;
		int change2 = 0;
		for( int i = 0 ; i < n ; i++ )
		{
			in = sc.next();
			sp = in.split( "," );
			change1 = Integer.parseInt(sp[0]);
			change2 = Integer.parseInt(sp[1]);
			
			work = street[change1];
			street[change1] = street[change2];
			street[change2] = work;
		}
		for( int w = 1 ; w < street.length ; w++ )
			System.out.println( street[w] );
	} java.util.Scanner sc = new java.util.Scanner( System.in ); sc new java.util.Scanner( System.in ) int[] street = new int[sc.nextInt()+1]; street new int[sc.nextInt()+1] sc.nextInt()+1 sc.nextInt() sc.nextInt sc 1 int   n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for( int w = 1 ; w < street.length ; w++ )
			street[w] = w; int w = 1 ; int w = 1 ; w 1 w < street.length w street.length street street.length w++ w++ w street[w] = w; street[w] = w street[w] street w w String in; in String[] sp; sp int work = 0; work 0 int change1 = 0; change1 0 int change2 = 0; change2 0 for( int i = 0 ; i < n ; i++ )
		{
			in = sc.next();
			sp = in.split( "," );
			change1 = Integer.parseInt(sp[0]);
			change2 = Integer.parseInt(sp[1]);
			
			work = street[change1];
			street[change1] = street[change2];
			street[change2] = work;
		} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
			in = sc.next();
			sp = in.split( "," );
			change1 = Integer.parseInt(sp[0]);
			change2 = Integer.parseInt(sp[1]);
			
			work = street[change1];
			street[change1] = street[change2];
			street[change2] = work;
		} {
			in = sc.next();
			sp = in.split( "," );
			change1 = Integer.parseInt(sp[0]);
			change2 = Integer.parseInt(sp[1]);
			
			work = street[change1];
			street[change1] = street[change2];
			street[change2] = work;
		} in = sc.next() in sc.next() sc.next sc sp = in.split( "," ) sp in.split( "," ) in.split in "," change1 = Integer.parseInt(sp[0]) change1 Integer.parseInt(sp[0]) Integer.parseInt Integer sp[0] sp 0 change2 = Integer.parseInt(sp[1]) change2 Integer.parseInt(sp[1]) Integer.parseInt Integer sp[1] sp 1 work = street[change1] work street[change1] street change1 street[change1] = street[change2] street[change1] street change1 street[change2] street change2 street[change2] = work street[change2] street change2 work for( int w = 1 ; w < street.length ; w++ )
			System.out.println( street[w] ); int w = 1 ; int w = 1 ; w 1 w < street.length w street.length street street.length w++ w++ w System.out.println( street[w] ); System.out.println( street[w] ) System.out.println System.out System System.out street[w] street w String[] args args
class Main
{
	public static void main( String[] args )
	{
		java.util.Scanner sc = new java.util.Scanner( System.in );
		
		int[] street = new int[sc.nextInt()+1];
		int   n = sc.nextInt();
		
		for( int w = 1 ; w < street.length ; w++ )
			street[w] = w;
			
		String in;
		String[] sp;
		int work = 0;
		int change1 = 0;
		int change2 = 0;
		for( int i = 0 ; i < n ; i++ )
		{
			in = sc.next();
			sp = in.split( "," );
			change1 = Integer.parseInt(sp[0]);
			change2 = Integer.parseInt(sp[1]);
			
			work = street[change1];
			street[change1] = street[change2];
			street[change2] = work;
		}
		for( int w = 1 ; w < street.length ; w++ )
			System.out.println( street[w] );
	}
}