import java.util.Scanner;
import java.lang.Math;
import java.math.BigDecimal;

public class Main{
	
	public static void main(String[] args){

		Scanner s = new Scanner(System.in);
		s.useDelimiter("\\s*,\\s*|\\s");
		
		int w = s.nextInt();
		int n = s.nextInt();
				
		int[] x = new int[w];
		
		for(int i = 0; i < w; i++){
			x[i] = i+1;
		}
		
		for(int i = 0; i < n; i++){
			
			int a = s.nextInt();
			int b = s.nextInt();
			
			int tmp = x[a-1];
			x[a-1] = x[b-1];
			x[b-1] = tmp;
			
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(x[i]);
		}
		
	}
	
} import java.util.Scanner; Scanner java.util import java.lang.Math; Math java.lang import java.math.BigDecimal; BigDecimal java.math public class Main{
	
	public static void main(String[] args){

		Scanner s = new Scanner(System.in);
		s.useDelimiter("\\s*,\\s*|\\s");
		
		int w = s.nextInt();
		int n = s.nextInt();
				
		int[] x = new int[w];
		
		for(int i = 0; i < w; i++){
			x[i] = i+1;
		}
		
		for(int i = 0; i < n; i++){
			
			int a = s.nextInt();
			int b = s.nextInt();
			
			int tmp = x[a-1];
			x[a-1] = x[b-1];
			x[b-1] = tmp;
			
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(x[i]);
		}
		
	}
	
} Main public static void main(String[] args){

		Scanner s = new Scanner(System.in);
		s.useDelimiter("\\s*,\\s*|\\s");
		
		int w = s.nextInt();
		int n = s.nextInt();
				
		int[] x = new int[w];
		
		for(int i = 0; i < w; i++){
			x[i] = i+1;
		}
		
		for(int i = 0; i < n; i++){
			
			int a = s.nextInt();
			int b = s.nextInt();
			
			int tmp = x[a-1];
			x[a-1] = x[b-1];
			x[b-1] = tmp;
			
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(x[i]);
		}
		
	} main {

		Scanner s = new Scanner(System.in);
		s.useDelimiter("\\s*,\\s*|\\s");
		
		int w = s.nextInt();
		int n = s.nextInt();
				
		int[] x = new int[w];
		
		for(int i = 0; i < w; i++){
			x[i] = i+1;
		}
		
		for(int i = 0; i < n; i++){
			
			int a = s.nextInt();
			int b = s.nextInt();
			
			int tmp = x[a-1];
			x[a-1] = x[b-1];
			x[b-1] = tmp;
			
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(x[i]);
		}
		
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) s.useDelimiter("\\s*,\\s*|\\s") s.useDelimiter s "\\s*,\\s*|\\s" int w = s.nextInt(); w s.nextInt() s.nextInt s int n = s.nextInt(); n s.nextInt() s.nextInt s int[] x = new int[w]; x new int[w] w for(int i = 0; i < w; i++){
			x[i] = i+1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			x[i] = i+1;
		} {
			x[i] = i+1;
		} x[i] = i+1 x[i] x i i+1 i 1 for(int i = 0; i < n; i++){
			
			int a = s.nextInt();
			int b = s.nextInt();
			
			int tmp = x[a-1];
			x[a-1] = x[b-1];
			x[b-1] = tmp;
			
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			
			int a = s.nextInt();
			int b = s.nextInt();
			
			int tmp = x[a-1];
			x[a-1] = x[b-1];
			x[b-1] = tmp;
			
		} {
			
			int a = s.nextInt();
			int b = s.nextInt();
			
			int tmp = x[a-1];
			x[a-1] = x[b-1];
			x[b-1] = tmp;
			
		} int a = s.nextInt(); a s.nextInt() s.nextInt s int b = s.nextInt(); b s.nextInt() s.nextInt s int tmp = x[a-1]; tmp x[a-1] x a-1 a 1 x[a-1] = x[b-1] x[a-1] x a-1 a 1 x[b-1] x b-1 b 1 x[b-1] = tmp x[b-1] x b-1 b 1 tmp for(int i = 0; i < w; i++){
			System.out.println(x[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(x[i]);
		} {
			System.out.println(x[i]);
		} System.out.println(x[i]) System.out.println System.out System System.out x[i] x i String[] args args public class Main{
	
	public static void main(String[] args){

		Scanner s = new Scanner(System.in);
		s.useDelimiter("\\s*,\\s*|\\s");
		
		int w = s.nextInt();
		int n = s.nextInt();
				
		int[] x = new int[w];
		
		for(int i = 0; i < w; i++){
			x[i] = i+1;
		}
		
		for(int i = 0; i < n; i++){
			
			int a = s.nextInt();
			int b = s.nextInt();
			
			int tmp = x[a-1];
			x[a-1] = x[b-1];
			x[b-1] = tmp;
			
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(x[i]);
		}
		
	}
	
} public class Main{
	
	public static void main(String[] args){

		Scanner s = new Scanner(System.in);
		s.useDelimiter("\\s*,\\s*|\\s");
		
		int w = s.nextInt();
		int n = s.nextInt();
				
		int[] x = new int[w];
		
		for(int i = 0; i < w; i++){
			x[i] = i+1;
		}
		
		for(int i = 0; i < n; i++){
			
			int a = s.nextInt();
			int b = s.nextInt();
			
			int tmp = x[a-1];
			x[a-1] = x[b-1];
			x[b-1] = tmp;
			
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(x[i]);
		}
		
	}
	
} Main
import java.util.Scanner;
import java.lang.Math;
import java.math.BigDecimal;

public class Main{
	
	public static void main(String[] args){

		Scanner s = new Scanner(System.in);
		s.useDelimiter("\\s*,\\s*|\\s");
		
		int w = s.nextInt();
		int n = s.nextInt();
				
		int[] x = new int[w];
		
		for(int i = 0; i < w; i++){
			x[i] = i+1;
		}
		
		for(int i = 0; i < n; i++){
			
			int a = s.nextInt();
			int b = s.nextInt();
			
			int tmp = x[a-1];
			x[a-1] = x[b-1];
			x[b-1] = tmp;
			
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(x[i]);
		}
		
	}
	
}
