import java.util.Scanner;

public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int lot[] = new int[w];

		String bar;
		String s[];
		int a;
		int b;
		int save;

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

		for (int i = 0; i < n; i++){
			bar = sc.next();
			s = bar.split(",");
			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);

			save = lot[b-1];
			lot[b-1] = lot[a-1];
			lot[a-1] = save;
		}

		for (int i = 0; i < w; i++){
		System.out.println("" + lot[i]);
		}

	}
} import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int lot[] = new int[w];

		String bar;
		String s[];
		int a;
		int b;
		int save;

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

		for (int i = 0; i < n; i++){
			bar = sc.next();
			s = bar.split(",");
			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);

			save = lot[b-1];
			lot[b-1] = lot[a-1];
			lot[a-1] = save;
		}

		for (int i = 0; i < w; i++){
		System.out.println("" + lot[i]);
		}

	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int lot[] = new int[w];

		String bar;
		String s[];
		int a;
		int b;
		int save;

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

		for (int i = 0; i < n; i++){
			bar = sc.next();
			s = bar.split(",");
			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);

			save = lot[b-1];
			lot[b-1] = lot[a-1];
			lot[a-1] = save;
		}

		for (int i = 0; i < w; i++){
		System.out.println("" + lot[i]);
		}

	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int lot[] = new int[w];

		String bar;
		String s[];
		int a;
		int b;
		int save;

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

		for (int i = 0; i < n; i++){
			bar = sc.next();
			s = bar.split(",");
			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);

			save = lot[b-1];
			lot[b-1] = lot[a-1];
			lot[a-1] = save;
		}

		for (int i = 0; i < w; i++){
		System.out.println("" + lot[i]);
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int lot[] = new int[w]; lot new int[w] w String bar; bar String s[]; s int a; a int b; b int save; save for (int i = 0; i < w; i++){
			lot[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			lot[i] = i + 1;
		} {
			lot[i] = i + 1;
		} lot[i] = i + 1 lot[i] lot i i + 1 i 1 for (int i = 0; i < n; i++){
			bar = sc.next();
			s = bar.split(",");
			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);

			save = lot[b-1];
			lot[b-1] = lot[a-1];
			lot[a-1] = save;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			bar = sc.next();
			s = bar.split(",");
			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);

			save = lot[b-1];
			lot[b-1] = lot[a-1];
			lot[a-1] = save;
		} {
			bar = sc.next();
			s = bar.split(",");
			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);

			save = lot[b-1];
			lot[b-1] = lot[a-1];
			lot[a-1] = save;
		} bar = sc.next() bar sc.next() sc.next sc s = bar.split(",") s bar.split(",") bar.split bar "," a = Integer.parseInt(s[0]) a Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 b = Integer.parseInt(s[1]) b Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 save = lot[b-1] save lot[b-1] lot b-1 b 1 lot[b-1] = lot[a-1] lot[b-1] lot b-1 b 1 lot[a-1] lot a-1 a 1 lot[a-1] = save lot[a-1] lot a-1 a 1 save for (int i = 0; i < w; i++){
		System.out.println("" + lot[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
		System.out.println("" + lot[i]);
		} {
		System.out.println("" + lot[i]);
		} System.out.println("" + lot[i]) System.out.println System.out System System.out "" + lot[i] "" lot[i] lot i String[] args args public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int lot[] = new int[w];

		String bar;
		String s[];
		int a;
		int b;
		int save;

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

		for (int i = 0; i < n; i++){
			bar = sc.next();
			s = bar.split(",");
			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);

			save = lot[b-1];
			lot[b-1] = lot[a-1];
			lot[a-1] = save;
		}

		for (int i = 0; i < w; i++){
		System.out.println("" + lot[i]);
		}

	}
} public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int lot[] = new int[w];

		String bar;
		String s[];
		int a;
		int b;
		int save;

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

		for (int i = 0; i < n; i++){
			bar = sc.next();
			s = bar.split(",");
			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);

			save = lot[b-1];
			lot[b-1] = lot[a-1];
			lot[a-1] = save;
		}

		for (int i = 0; i < w; i++){
		System.out.println("" + lot[i]);
		}

	}
} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int lot[] = new int[w];

		String bar;
		String s[];
		int a;
		int b;
		int save;

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

		for (int i = 0; i < n; i++){
			bar = sc.next();
			s = bar.split(",");
			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);

			save = lot[b-1];
			lot[b-1] = lot[a-1];
			lot[a-1] = save;
		}

		for (int i = 0; i < w; i++){
		System.out.println("" + lot[i]);
		}

	}
}