import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int[] x = new int[w];
		for(int i = 0;i < w;i++){
			x[i] = i+1;
		}
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){
			String str = scan.next();
			String[] strAry = str.split(","); 
			int a = Integer.parseInt(strAry[0]) - 1;
			int b = Integer.parseInt(strAry[1]) - 1;
			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}
		for(int i = 0;i < w;i++){
			System.out.println(x[i]);
		}
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int[] x = new int[w];
		for(int i = 0;i < w;i++){
			x[i] = i+1;
		}
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){
			String str = scan.next();
			String[] strAry = str.split(","); 
			int a = Integer.parseInt(strAry[0]) - 1;
			int b = Integer.parseInt(strAry[1]) - 1;
			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}
		for(int i = 0;i < w;i++){
			System.out.println(x[i]);
		}
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int[] x = new int[w];
		for(int i = 0;i < w;i++){
			x[i] = i+1;
		}
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){
			String str = scan.next();
			String[] strAry = str.split(","); 
			int a = Integer.parseInt(strAry[0]) - 1;
			int b = Integer.parseInt(strAry[1]) - 1;
			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}
		for(int i = 0;i < w;i++){
			System.out.println(x[i]);
		}
	} main {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int[] x = new int[w];
		for(int i = 0;i < w;i++){
			x[i] = i+1;
		}
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){
			String str = scan.next();
			String[] strAry = str.split(","); 
			int a = Integer.parseInt(strAry[0]) - 1;
			int b = Integer.parseInt(strAry[1]) - 1;
			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}
		for(int i = 0;i < w;i++){
			System.out.println(x[i]);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan 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 int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan for(int i = 0;i < n;i++){
			String str = scan.next();
			String[] strAry = str.split(","); 
			int a = Integer.parseInt(strAry[0]) - 1;
			int b = Integer.parseInt(strAry[1]) - 1;
			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String str = scan.next();
			String[] strAry = str.split(","); 
			int a = Integer.parseInt(strAry[0]) - 1;
			int b = Integer.parseInt(strAry[1]) - 1;
			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		} {
			String str = scan.next();
			String[] strAry = str.split(","); 
			int a = Integer.parseInt(strAry[0]) - 1;
			int b = Integer.parseInt(strAry[1]) - 1;
			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		} String str = scan.next(); str scan.next() scan.next scan String[] strAry = str.split(","); strAry str.split(",") str.split str "," int a = Integer.parseInt(strAry[0]) - 1; a Integer.parseInt(strAry[0]) - 1 Integer.parseInt(strAry[0]) Integer.parseInt Integer strAry[0] strAry 0 1 int b = Integer.parseInt(strAry[1]) - 1; b Integer.parseInt(strAry[1]) - 1 Integer.parseInt(strAry[1]) Integer.parseInt Integer strAry[1] strAry 1 1 int t = x[a]; t x[a] x a x[a] = x[b] x[a] x a x[b] x b x[b] = t x[b] x b t 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
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int[] x = new int[w];
		for(int i = 0;i < w;i++){
			x[i] = i+1;
		}
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){
			String str = scan.next();
			String[] strAry = str.split(","); 
			int a = Integer.parseInt(strAry[0]) - 1;
			int b = Integer.parseInt(strAry[1]) - 1;
			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}
		for(int i = 0;i < w;i++){
			System.out.println(x[i]);
		}
	}
}