import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int w, n, l[][], num[];
		int i;
		int tmp;
		String str;
		String str1[];

		Scanner sc = new Scanner(System.in);

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

		num = new int[w];
		str1 = new String[2];

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

		l = new int[n][2];

		for (i = 0; i < n; ++i) {
			str = sc.next();
			str1 = str.split(",");
			l[i][0] = Integer.parseInt(str1[0]) - 1;
			l[i][1] = Integer.parseInt(str1[1]) - 1;
			// swap
			tmp = num[l[i][0]];
			num[l[i][0]] = num[l[i][1]];
			num[l[i][1]] = tmp;
		}
		// show answer
		for (i = 0; i < w; ++i) {
			System.out.println(num[i]);
		}
		sc.close();
	}

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

	public static void main(String[] args) {
		int w, n, l[][], num[];
		int i;
		int tmp;
		String str;
		String str1[];

		Scanner sc = new Scanner(System.in);

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

		num = new int[w];
		str1 = new String[2];

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

		l = new int[n][2];

		for (i = 0; i < n; ++i) {
			str = sc.next();
			str1 = str.split(",");
			l[i][0] = Integer.parseInt(str1[0]) - 1;
			l[i][1] = Integer.parseInt(str1[1]) - 1;
			// swap
			tmp = num[l[i][0]];
			num[l[i][0]] = num[l[i][1]];
			num[l[i][1]] = tmp;
		}
		// show answer
		for (i = 0; i < w; ++i) {
			System.out.println(num[i]);
		}
		sc.close();
	}

} Main public static void main(String[] args) {
		int w, n, l[][], num[];
		int i;
		int tmp;
		String str;
		String str1[];

		Scanner sc = new Scanner(System.in);

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

		num = new int[w];
		str1 = new String[2];

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

		l = new int[n][2];

		for (i = 0; i < n; ++i) {
			str = sc.next();
			str1 = str.split(",");
			l[i][0] = Integer.parseInt(str1[0]) - 1;
			l[i][1] = Integer.parseInt(str1[1]) - 1;
			// swap
			tmp = num[l[i][0]];
			num[l[i][0]] = num[l[i][1]];
			num[l[i][1]] = tmp;
		}
		// show answer
		for (i = 0; i < w; ++i) {
			System.out.println(num[i]);
		}
		sc.close();
	} main {
		int w, n, l[][], num[];
		int i;
		int tmp;
		String str;
		String str1[];

		Scanner sc = new Scanner(System.in);

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

		num = new int[w];
		str1 = new String[2];

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

		l = new int[n][2];

		for (i = 0; i < n; ++i) {
			str = sc.next();
			str1 = str.split(",");
			l[i][0] = Integer.parseInt(str1[0]) - 1;
			l[i][1] = Integer.parseInt(str1[1]) - 1;
			// swap
			tmp = num[l[i][0]];
			num[l[i][0]] = num[l[i][1]];
			num[l[i][1]] = tmp;
		}
		// show answer
		for (i = 0; i < w; ++i) {
			System.out.println(num[i]);
		}
		sc.close();
	} int w w n n l[][] l num[]; num int i; i int tmp; tmp String str; str String str1[]; str1 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) w = sc.nextInt() w sc.nextInt() sc.nextInt sc n = sc.nextInt() n sc.nextInt() sc.nextInt sc num = new int[w] num new int[w] w str1 = new String[2] str1 new String[2] 2 for (i = 0; i < w; ++i) {
			num[i] = i + 1;
		} i = 0; i = 0 i 0 i < w i w ++i ++i i {
			num[i] = i + 1;
		} {
			num[i] = i + 1;
		} num[i] = i + 1 num[i] num i i + 1 i 1 l = new int[n][2] l new int[n][2] n 2 for (i = 0; i < n; ++i) {
			str = sc.next();
			str1 = str.split(",");
			l[i][0] = Integer.parseInt(str1[0]) - 1;
			l[i][1] = Integer.parseInt(str1[1]) - 1;
			// swap
			tmp = num[l[i][0]];
			num[l[i][0]] = num[l[i][1]];
			num[l[i][1]] = tmp;
		} i = 0; i = 0 i 0 i < n i n ++i ++i i {
			str = sc.next();
			str1 = str.split(",");
			l[i][0] = Integer.parseInt(str1[0]) - 1;
			l[i][1] = Integer.parseInt(str1[1]) - 1;
			// swap
			tmp = num[l[i][0]];
			num[l[i][0]] = num[l[i][1]];
			num[l[i][1]] = tmp;
		} {
			str = sc.next();
			str1 = str.split(",");
			l[i][0] = Integer.parseInt(str1[0]) - 1;
			l[i][1] = Integer.parseInt(str1[1]) - 1;
			// swap
			tmp = num[l[i][0]];
			num[l[i][0]] = num[l[i][1]];
			num[l[i][1]] = tmp;
		} str = sc.next() str sc.next() sc.next sc str1 = str.split(",") str1 str.split(",") str.split str "," l[i][0] = Integer.parseInt(str1[0]) - 1 l[i][0] l[i] l i 0 Integer.parseInt(str1[0]) - 1 Integer.parseInt(str1[0]) Integer.parseInt Integer str1[0] str1 0 1 l[i][1] = Integer.parseInt(str1[1]) - 1 l[i][1] l[i] l i 1 Integer.parseInt(str1[1]) - 1 Integer.parseInt(str1[1]) Integer.parseInt Integer str1[1] str1 1 1 tmp = num[l[i][0]] tmp num[l[i][0]] num l[i][0] l[i] l i 0 num[l[i][0]] = num[l[i][1]] num[l[i][0]] num l[i][0] l[i] l i 0 num[l[i][1]] num l[i][1] l[i] l i 1 num[l[i][1]] = tmp num[l[i][1]] num l[i][1] l[i] l i 1 tmp for (i = 0; i < w; ++i) {
			System.out.println(num[i]);
		} i = 0; i = 0 i 0 i < w i w ++i ++i i {
			System.out.println(num[i]);
		} {
			System.out.println(num[i]);
		} System.out.println(num[i]) System.out.println System.out System System.out num[i] num i sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		int w, n, l[][], num[];
		int i;
		int tmp;
		String str;
		String str1[];

		Scanner sc = new Scanner(System.in);

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

		num = new int[w];
		str1 = new String[2];

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

		l = new int[n][2];

		for (i = 0; i < n; ++i) {
			str = sc.next();
			str1 = str.split(",");
			l[i][0] = Integer.parseInt(str1[0]) - 1;
			l[i][1] = Integer.parseInt(str1[1]) - 1;
			// swap
			tmp = num[l[i][0]];
			num[l[i][0]] = num[l[i][1]];
			num[l[i][1]] = tmp;
		}
		// show answer
		for (i = 0; i < w; ++i) {
			System.out.println(num[i]);
		}
		sc.close();
	}

} public class Main {

	public static void main(String[] args) {
		int w, n, l[][], num[];
		int i;
		int tmp;
		String str;
		String str1[];

		Scanner sc = new Scanner(System.in);

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

		num = new int[w];
		str1 = new String[2];

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

		l = new int[n][2];

		for (i = 0; i < n; ++i) {
			str = sc.next();
			str1 = str.split(",");
			l[i][0] = Integer.parseInt(str1[0]) - 1;
			l[i][1] = Integer.parseInt(str1[1]) - 1;
			// swap
			tmp = num[l[i][0]];
			num[l[i][0]] = num[l[i][1]];
			num[l[i][1]] = tmp;
		}
		// show answer
		for (i = 0; i < w; ++i) {
			System.out.println(num[i]);
		}
		sc.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int w, n, l[][], num[];
		int i;
		int tmp;
		String str;
		String str1[];

		Scanner sc = new Scanner(System.in);

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

		num = new int[w];
		str1 = new String[2];

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

		l = new int[n][2];

		for (i = 0; i < n; ++i) {
			str = sc.next();
			str1 = str.split(",");
			l[i][0] = Integer.parseInt(str1[0]) - 1;
			l[i][1] = Integer.parseInt(str1[1]) - 1;
			// swap
			tmp = num[l[i][0]];
			num[l[i][0]] = num[l[i][1]];
			num[l[i][1]] = tmp;
		}
		// show answer
		for (i = 0; i < w; ++i) {
			System.out.println(num[i]);
		}
		sc.close();
	}

}
