

import java.util.Scanner;

class Main{


	public static void main(String[] a){

		Scanner sc = new Scanner(System.in);


		int tatebo = sc.nextInt();
		int yokobo = sc.nextInt();

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


		for(int i = 0; i < yokobo; i++) {

			String tmp1 = sc.next();
			String tmp2 [] = tmp1.split(",");
			int tmp3 = 0;

			int x = Integer.valueOf(tmp2[0]) - 1;
			int y = Integer.valueOf(tmp2[1]) - 1;


			tmp3 = num[x];
			num[x] = num[y];
			num[y] = tmp3;
		}


		for(int i: num) {

			System.out.println(String.valueOf(i));
		}

	}

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


	public static void main(String[] a){

		Scanner sc = new Scanner(System.in);


		int tatebo = sc.nextInt();
		int yokobo = sc.nextInt();

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


		for(int i = 0; i < yokobo; i++) {

			String tmp1 = sc.next();
			String tmp2 [] = tmp1.split(",");
			int tmp3 = 0;

			int x = Integer.valueOf(tmp2[0]) - 1;
			int y = Integer.valueOf(tmp2[1]) - 1;


			tmp3 = num[x];
			num[x] = num[y];
			num[y] = tmp3;
		}


		for(int i: num) {

			System.out.println(String.valueOf(i));
		}

	}

} Main public static void main(String[] a){

		Scanner sc = new Scanner(System.in);


		int tatebo = sc.nextInt();
		int yokobo = sc.nextInt();

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


		for(int i = 0; i < yokobo; i++) {

			String tmp1 = sc.next();
			String tmp2 [] = tmp1.split(",");
			int tmp3 = 0;

			int x = Integer.valueOf(tmp2[0]) - 1;
			int y = Integer.valueOf(tmp2[1]) - 1;


			tmp3 = num[x];
			num[x] = num[y];
			num[y] = tmp3;
		}


		for(int i: num) {

			System.out.println(String.valueOf(i));
		}

	} main {

		Scanner sc = new Scanner(System.in);


		int tatebo = sc.nextInt();
		int yokobo = sc.nextInt();

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


		for(int i = 0; i < yokobo; i++) {

			String tmp1 = sc.next();
			String tmp2 [] = tmp1.split(",");
			int tmp3 = 0;

			int x = Integer.valueOf(tmp2[0]) - 1;
			int y = Integer.valueOf(tmp2[1]) - 1;


			tmp3 = num[x];
			num[x] = num[y];
			num[y] = tmp3;
		}


		for(int i: num) {

			System.out.println(String.valueOf(i));
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int tatebo = sc.nextInt(); tatebo sc.nextInt() sc.nextInt sc int yokobo = sc.nextInt(); yokobo sc.nextInt() sc.nextInt sc int num [] = new int[tatebo]; num new int[tatebo] tatebo for(int i = 0; i < tatebo; i++) {
			num[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < tatebo i tatebo i++ i++ i {
			num[i] = i + 1;
		} {
			num[i] = i + 1;
		} num[i] = i + 1 num[i] num i i + 1 i 1 for(int i = 0; i < yokobo; i++) {

			String tmp1 = sc.next();
			String tmp2 [] = tmp1.split(",");
			int tmp3 = 0;

			int x = Integer.valueOf(tmp2[0]) - 1;
			int y = Integer.valueOf(tmp2[1]) - 1;


			tmp3 = num[x];
			num[x] = num[y];
			num[y] = tmp3;
		} int i = 0; int i = 0; i 0 i < yokobo i yokobo i++ i++ i {

			String tmp1 = sc.next();
			String tmp2 [] = tmp1.split(",");
			int tmp3 = 0;

			int x = Integer.valueOf(tmp2[0]) - 1;
			int y = Integer.valueOf(tmp2[1]) - 1;


			tmp3 = num[x];
			num[x] = num[y];
			num[y] = tmp3;
		} {

			String tmp1 = sc.next();
			String tmp2 [] = tmp1.split(",");
			int tmp3 = 0;

			int x = Integer.valueOf(tmp2[0]) - 1;
			int y = Integer.valueOf(tmp2[1]) - 1;


			tmp3 = num[x];
			num[x] = num[y];
			num[y] = tmp3;
		} String tmp1 = sc.next(); tmp1 sc.next() sc.next sc String tmp2 [] = tmp1.split(","); tmp2 tmp1.split(",") tmp1.split tmp1 "," int tmp3 = 0; tmp3 0 int x = Integer.valueOf(tmp2[0]) - 1; x Integer.valueOf(tmp2[0]) - 1 Integer.valueOf(tmp2[0]) Integer.valueOf Integer tmp2[0] tmp2 0 1 int y = Integer.valueOf(tmp2[1]) - 1; y Integer.valueOf(tmp2[1]) - 1 Integer.valueOf(tmp2[1]) Integer.valueOf Integer tmp2[1] tmp2 1 1 tmp3 = num[x] tmp3 num[x] num x num[x] = num[y] num[x] num x num[y] num y num[y] = tmp3 num[y] num y tmp3 for(int i: num) {

			System.out.println(String.valueOf(i));
		} int i num {

			System.out.println(String.valueOf(i));
		} {

			System.out.println(String.valueOf(i));
		} System.out.println(String.valueOf(i)) System.out.println System.out System System.out String.valueOf(i) String.valueOf String i String[] a a


import java.util.Scanner;

class Main{


	public static void main(String[] a){

		Scanner sc = new Scanner(System.in);


		int tatebo = sc.nextInt();
		int yokobo = sc.nextInt();

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


		for(int i = 0; i < yokobo; i++) {

			String tmp1 = sc.next();
			String tmp2 [] = tmp1.split(",");
			int tmp3 = 0;

			int x = Integer.valueOf(tmp2[0]) - 1;
			int y = Integer.valueOf(tmp2[1]) - 1;


			tmp3 = num[x];
			num[x] = num[y];
			num[y] = tmp3;
		}


		for(int i: num) {

			System.out.println(String.valueOf(i));
		}

	}

}