import java.io.*;
import java.lang.*;
import java.util.Scanner;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);
		int w, n, i, tmp;
		int L,R;
		int list[];

		w = sc.nextInt();
		n = sc.nextInt();

		sc.useDelimiter(",| |\\n");

		list = new int[w + 1];
		for(i = 0; i < w; i++){
			list[i + 1] = i + 1;
		}

		for(i = 0; i < n; i++){
			L = sc.nextInt();
			sc.skip(",");
			R = sc.nextInt();
			//System.out.println(L + "," + R);
			tmp = list[L];
			list[L] = list[R];
			list[R] = tmp;
		}

		for(i = 0; i < w; i++){
			System.out.println(list[i + 1]);
		}
		
	}
} import java.io.*; io.* java import java.lang.*; lang.* java import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);
		int w, n, i, tmp;
		int L,R;
		int list[];

		w = sc.nextInt();
		n = sc.nextInt();

		sc.useDelimiter(",| |\\n");

		list = new int[w + 1];
		for(i = 0; i < w; i++){
			list[i + 1] = i + 1;
		}

		for(i = 0; i < n; i++){
			L = sc.nextInt();
			sc.skip(",");
			R = sc.nextInt();
			//System.out.println(L + "," + R);
			tmp = list[L];
			list[L] = list[R];
			list[R] = tmp;
		}

		for(i = 0; i < w; i++){
			System.out.println(list[i + 1]);
		}
		
	}
} Main public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);
		int w, n, i, tmp;
		int L,R;
		int list[];

		w = sc.nextInt();
		n = sc.nextInt();

		sc.useDelimiter(",| |\\n");

		list = new int[w + 1];
		for(i = 0; i < w; i++){
			list[i + 1] = i + 1;
		}

		for(i = 0; i < n; i++){
			L = sc.nextInt();
			sc.skip(",");
			R = sc.nextInt();
			//System.out.println(L + "," + R);
			tmp = list[L];
			list[L] = list[R];
			list[R] = tmp;
		}

		for(i = 0; i < w; i++){
			System.out.println(list[i + 1]);
		}
		
	} main {
		Scanner sc = new Scanner(System.in);
		int w, n, i, tmp;
		int L,R;
		int list[];

		w = sc.nextInt();
		n = sc.nextInt();

		sc.useDelimiter(",| |\\n");

		list = new int[w + 1];
		for(i = 0; i < w; i++){
			list[i + 1] = i + 1;
		}

		for(i = 0; i < n; i++){
			L = sc.nextInt();
			sc.skip(",");
			R = sc.nextInt();
			//System.out.println(L + "," + R);
			tmp = list[L];
			list[L] = list[R];
			list[R] = tmp;
		}

		for(i = 0; i < w; i++){
			System.out.println(list[i + 1]);
		}
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w w n n i i tmp; tmp int L L R; R int list[]; list w = sc.nextInt() w sc.nextInt() sc.nextInt sc n = sc.nextInt() n sc.nextInt() sc.nextInt sc sc.useDelimiter(",| |\\n") sc.useDelimiter sc ",| |\\n" list = new int[w + 1] list new int[w + 1] w + 1 w 1 for(i = 0; i < w; i++){
			list[i + 1] = i + 1;
		} i = 0; i = 0 i 0 i < w i w i++ i++ i {
			list[i + 1] = i + 1;
		} {
			list[i + 1] = i + 1;
		} list[i + 1] = i + 1 list[i + 1] list i + 1 i 1 i + 1 i 1 for(i = 0; i < n; i++){
			L = sc.nextInt();
			sc.skip(",");
			R = sc.nextInt();
			//System.out.println(L + "," + R);
			tmp = list[L];
			list[L] = list[R];
			list[R] = tmp;
		} i = 0; i = 0 i 0 i < n i n i++ i++ i {
			L = sc.nextInt();
			sc.skip(",");
			R = sc.nextInt();
			//System.out.println(L + "," + R);
			tmp = list[L];
			list[L] = list[R];
			list[R] = tmp;
		} {
			L = sc.nextInt();
			sc.skip(",");
			R = sc.nextInt();
			//System.out.println(L + "," + R);
			tmp = list[L];
			list[L] = list[R];
			list[R] = tmp;
		} L = sc.nextInt() L sc.nextInt() sc.nextInt sc sc.skip(",") sc.skip sc "," R = sc.nextInt() R sc.nextInt() sc.nextInt sc tmp = list[L] tmp list[L] list L list[L] = list[R] list[L] list L list[R] list R list[R] = tmp list[R] list R tmp for(i = 0; i < w; i++){
			System.out.println(list[i + 1]);
		} i = 0; i = 0 i 0 i < w i w i++ i++ i {
			System.out.println(list[i + 1]);
		} {
			System.out.println(list[i + 1]);
		} System.out.println(list[i + 1]) System.out.println System.out System System.out list[i + 1] list i + 1 i 1 String[] args args public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);
		int w, n, i, tmp;
		int L,R;
		int list[];

		w = sc.nextInt();
		n = sc.nextInt();

		sc.useDelimiter(",| |\\n");

		list = new int[w + 1];
		for(i = 0; i < w; i++){
			list[i + 1] = i + 1;
		}

		for(i = 0; i < n; i++){
			L = sc.nextInt();
			sc.skip(",");
			R = sc.nextInt();
			//System.out.println(L + "," + R);
			tmp = list[L];
			list[L] = list[R];
			list[R] = tmp;
		}

		for(i = 0; i < w; i++){
			System.out.println(list[i + 1]);
		}
		
	}
} public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);
		int w, n, i, tmp;
		int L,R;
		int list[];

		w = sc.nextInt();
		n = sc.nextInt();

		sc.useDelimiter(",| |\\n");

		list = new int[w + 1];
		for(i = 0; i < w; i++){
			list[i + 1] = i + 1;
		}

		for(i = 0; i < n; i++){
			L = sc.nextInt();
			sc.skip(",");
			R = sc.nextInt();
			//System.out.println(L + "," + R);
			tmp = list[L];
			list[L] = list[R];
			list[R] = tmp;
		}

		for(i = 0; i < w; i++){
			System.out.println(list[i + 1]);
		}
		
	}
} Main
import java.io.*;
import java.lang.*;
import java.util.Scanner;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);
		int w, n, i, tmp;
		int L,R;
		int list[];

		w = sc.nextInt();
		n = sc.nextInt();

		sc.useDelimiter(",| |\\n");

		list = new int[w + 1];
		for(i = 0; i < w; i++){
			list[i + 1] = i + 1;
		}

		for(i = 0; i < n; i++){
			L = sc.nextInt();
			sc.skip(",");
			R = sc.nextInt();
			//System.out.println(L + "," + R);
			tmp = list[L];
			list[L] = list[R];
			list[R] = tmp;
		}

		for(i = 0; i < w; i++){
			System.out.println(list[i + 1]);
		}
		
	}
}