

import java.util.Scanner;

public class Main {

	int[] a;
	int[] x;
	int[] y;

	public void run() {
		Scanner sc = new Scanner(System.in);

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

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

		x = new int[n];
		y = new int[n];

		String[] str = new String[2];

		for (int i = 0; i < n; i++) {
			str = sc.next().split(",");
			x[i] = Integer.parseInt(str[0]);
			y[i] = Integer.parseInt(str[1]);
		}

		for (int i = 0; i < n; i++) {
			int tmp = a[x[i]];
			a[x[i]] = a[y[i]];
			a[y[i]] = tmp;
		}

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

		sc.close();
	}

	public static void main(String[] args) {
		new Main().run();
	}

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

	int[] a;
	int[] x;
	int[] y;

	public void run() {
		Scanner sc = new Scanner(System.in);

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

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

		x = new int[n];
		y = new int[n];

		String[] str = new String[2];

		for (int i = 0; i < n; i++) {
			str = sc.next().split(",");
			x[i] = Integer.parseInt(str[0]);
			y[i] = Integer.parseInt(str[1]);
		}

		for (int i = 0; i < n; i++) {
			int tmp = a[x[i]];
			a[x[i]] = a[y[i]];
			a[y[i]] = tmp;
		}

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

		sc.close();
	}

	public static void main(String[] args) {
		new Main().run();
	}

} Main int[] a; a int[] x; x int[] y; y public void run() {
		Scanner sc = new Scanner(System.in);

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

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

		x = new int[n];
		y = new int[n];

		String[] str = new String[2];

		for (int i = 0; i < n; i++) {
			str = sc.next().split(",");
			x[i] = Integer.parseInt(str[0]);
			y[i] = Integer.parseInt(str[1]);
		}

		for (int i = 0; i < n; i++) {
			int tmp = a[x[i]];
			a[x[i]] = a[y[i]];
			a[y[i]] = tmp;
		}

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

		sc.close();
	} run {
		Scanner sc = new Scanner(System.in);

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

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

		x = new int[n];
		y = new int[n];

		String[] str = new String[2];

		for (int i = 0; i < n; i++) {
			str = sc.next().split(",");
			x[i] = Integer.parseInt(str[0]);
			y[i] = Integer.parseInt(str[1]);
		}

		for (int i = 0; i < n; i++) {
			int tmp = a[x[i]];
			a[x[i]] = a[y[i]];
			a[y[i]] = tmp;
		}

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

		sc.close();
	} 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 a = new int[w + 1] a new int[w + 1] w + 1 w 1 for (int i = 1; i <= w; i++) {
			a[i] = i;
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			a[i] = i;
		} {
			a[i] = i;
		} a[i] = i a[i] a i i x = new int[n] x new int[n] n y = new int[n] y new int[n] n String[] str = new String[2]; str new String[2] 2 for (int i = 0; i < n; i++) {
			str = sc.next().split(",");
			x[i] = Integer.parseInt(str[0]);
			y[i] = Integer.parseInt(str[1]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			str = sc.next().split(",");
			x[i] = Integer.parseInt(str[0]);
			y[i] = Integer.parseInt(str[1]);
		} {
			str = sc.next().split(",");
			x[i] = Integer.parseInt(str[0]);
			y[i] = Integer.parseInt(str[1]);
		} str = sc.next().split(",") str sc.next().split(",") sc.next().split sc.next() sc.next sc "," x[i] = Integer.parseInt(str[0]) x[i] x i Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 y[i] = Integer.parseInt(str[1]) y[i] y i Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 for (int i = 0; i < n; i++) {
			int tmp = a[x[i]];
			a[x[i]] = a[y[i]];
			a[y[i]] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int tmp = a[x[i]];
			a[x[i]] = a[y[i]];
			a[y[i]] = tmp;
		} {
			int tmp = a[x[i]];
			a[x[i]] = a[y[i]];
			a[y[i]] = tmp;
		} int tmp = a[x[i]]; tmp a[x[i]] a x[i] x i a[x[i]] = a[y[i]] a[x[i]] a x[i] x i a[y[i]] a y[i] y i a[y[i]] = tmp a[y[i]] a y[i] y i tmp for (int i = 1; i <= w; i++) {
			System.out.println(a[i]);
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			System.out.println(a[i]);
		} {
			System.out.println(a[i]);
		} System.out.println(a[i]) System.out.println System.out System System.out a[i] a i sc.close() sc.close sc public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {

	int[] a;
	int[] x;
	int[] y;

	public void run() {
		Scanner sc = new Scanner(System.in);

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

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

		x = new int[n];
		y = new int[n];

		String[] str = new String[2];

		for (int i = 0; i < n; i++) {
			str = sc.next().split(",");
			x[i] = Integer.parseInt(str[0]);
			y[i] = Integer.parseInt(str[1]);
		}

		for (int i = 0; i < n; i++) {
			int tmp = a[x[i]];
			a[x[i]] = a[y[i]];
			a[y[i]] = tmp;
		}

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

		sc.close();
	}

	public static void main(String[] args) {
		new Main().run();
	}

} public class Main {

	int[] a;
	int[] x;
	int[] y;

	public void run() {
		Scanner sc = new Scanner(System.in);

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

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

		x = new int[n];
		y = new int[n];

		String[] str = new String[2];

		for (int i = 0; i < n; i++) {
			str = sc.next().split(",");
			x[i] = Integer.parseInt(str[0]);
			y[i] = Integer.parseInt(str[1]);
		}

		for (int i = 0; i < n; i++) {
			int tmp = a[x[i]];
			a[x[i]] = a[y[i]];
			a[y[i]] = tmp;
		}

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

		sc.close();
	}

	public static void main(String[] args) {
		new Main().run();
	}

} Main


import java.util.Scanner;

public class Main {

	int[] a;
	int[] x;
	int[] y;

	public void run() {
		Scanner sc = new Scanner(System.in);

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

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

		x = new int[n];
		y = new int[n];

		String[] str = new String[2];

		for (int i = 0; i < n; i++) {
			str = sc.next().split(",");
			x[i] = Integer.parseInt(str[0]);
			y[i] = Integer.parseInt(str[1]);
		}

		for (int i = 0; i < n; i++) {
			int tmp = a[x[i]];
			a[x[i]] = a[y[i]];
			a[y[i]] = tmp;
		}

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

		sc.close();
	}

	public static void main(String[] args) {
		new Main().run();
	}

}