import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

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

		int[] ans;
		ans = new int[w + 1];

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

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

		for (int i = 1; i <= w; i++) {
			System.out.println(ans[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, n;
		w = sc.nextInt();
		n = sc.nextInt();

		int[] ans;
		ans = new int[w + 1];

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

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

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

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

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

		int[] ans;
		ans = new int[w + 1];

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

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

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

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

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

		int[] ans;
		ans = new int[w + 1];

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

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

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

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

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

		int[] ans;
		ans = new int[w + 1];

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

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

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

	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

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

		int[] ans;
		ans = new int[w + 1];

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

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

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

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

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

		int[] ans;
		ans = new int[w + 1];

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

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

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

	}
}
