import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int[] a = new int[w+1];
		for (int i = 1; i <= w; i++)
			a[i] = i;
		int s = stdIn.nextInt();
		for (; s != 0; s--) {
			String[] S = stdIn.next().split(",");
			int l = Integer.parseInt(S[0]);
			int r = Integer.parseInt(S[1]);
			int t = a[l];
			a[l] = a[r];
			a[r] = t;
		}
		for (int i = 1; i <= w; i++)
			System.out.println(a[i]);

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int[] a = new int[w+1];
		for (int i = 1; i <= w; i++)
			a[i] = i;
		int s = stdIn.nextInt();
		for (; s != 0; s--) {
			String[] S = stdIn.next().split(",");
			int l = Integer.parseInt(S[0]);
			int r = Integer.parseInt(S[1]);
			int t = a[l];
			a[l] = a[r];
			a[r] = t;
		}
		for (int i = 1; i <= w; i++)
			System.out.println(a[i]);

	}
} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int[] a = new int[w+1];
		for (int i = 1; i <= w; i++)
			a[i] = i;
		int s = stdIn.nextInt();
		for (; s != 0; s--) {
			String[] S = stdIn.next().split(",");
			int l = Integer.parseInt(S[0]);
			int r = Integer.parseInt(S[1]);
			int t = a[l];
			a[l] = a[r];
			a[r] = t;
		}
		for (int i = 1; i <= w; i++)
			System.out.println(a[i]);

	} main {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int[] a = new int[w+1];
		for (int i = 1; i <= w; i++)
			a[i] = i;
		int s = stdIn.nextInt();
		for (; s != 0; s--) {
			String[] S = stdIn.next().split(",");
			int l = Integer.parseInt(S[0]);
			int r = Integer.parseInt(S[1]);
			int t = a[l];
			a[l] = a[r];
			a[r] = t;
		}
		for (int i = 1; i <= w; i++)
			System.out.println(a[i]);

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

	}
} public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int[] a = new int[w+1];
		for (int i = 1; i <= w; i++)
			a[i] = i;
		int s = stdIn.nextInt();
		for (; s != 0; s--) {
			String[] S = stdIn.next().split(",");
			int l = Integer.parseInt(S[0]);
			int r = Integer.parseInt(S[1]);
			int t = a[l];
			a[l] = a[r];
			a[r] = t;
		}
		for (int i = 1; i <= w; i++)
			System.out.println(a[i]);

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int[] a = new int[w+1];
		for (int i = 1; i <= w; i++)
			a[i] = i;
		int s = stdIn.nextInt();
		for (; s != 0; s--) {
			String[] S = stdIn.next().split(",");
			int l = Integer.parseInt(S[0]);
			int r = Integer.parseInt(S[1]);
			int t = a[l];
			a[l] = a[r];
			a[r] = t;
		}
		for (int i = 1; i <= w; i++)
			System.out.println(a[i]);

	}
}