import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int size = in.nextInt();
		int n = in.nextInt();
		int[] lines = new int[size];
		int a, b;
		for (int i = 0; i < lines.length; i++) {
			lines[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String input = in.next();
			a = Integer.parseInt(input.split(",")[0]);
			b = Integer.parseInt(input.split(",")[1]);
			lines = swap(a, b, lines);
		}
		for (int i = 0; i < lines.length; i++) {
			System.out.println(lines[i]);
		}
		in.close();
	}

	public static int[] swap(int a, int b, int[] lines) {
		int temp = lines[a - 1];
		lines[a - 1] = lines[b - 1];
		lines[b - 1] = temp;
		return lines;
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int size = in.nextInt();
		int n = in.nextInt();
		int[] lines = new int[size];
		int a, b;
		for (int i = 0; i < lines.length; i++) {
			lines[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String input = in.next();
			a = Integer.parseInt(input.split(",")[0]);
			b = Integer.parseInt(input.split(",")[1]);
			lines = swap(a, b, lines);
		}
		for (int i = 0; i < lines.length; i++) {
			System.out.println(lines[i]);
		}
		in.close();
	}

	public static int[] swap(int a, int b, int[] lines) {
		int temp = lines[a - 1];
		lines[a - 1] = lines[b - 1];
		lines[b - 1] = temp;
		return lines;
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int size = in.nextInt();
		int n = in.nextInt();
		int[] lines = new int[size];
		int a, b;
		for (int i = 0; i < lines.length; i++) {
			lines[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String input = in.next();
			a = Integer.parseInt(input.split(",")[0]);
			b = Integer.parseInt(input.split(",")[1]);
			lines = swap(a, b, lines);
		}
		for (int i = 0; i < lines.length; i++) {
			System.out.println(lines[i]);
		}
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		int size = in.nextInt();
		int n = in.nextInt();
		int[] lines = new int[size];
		int a, b;
		for (int i = 0; i < lines.length; i++) {
			lines[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String input = in.next();
			a = Integer.parseInt(input.split(",")[0]);
			b = Integer.parseInt(input.split(",")[1]);
			lines = swap(a, b, lines);
		}
		for (int i = 0; i < lines.length; i++) {
			System.out.println(lines[i]);
		}
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int size = in.nextInt(); size in.nextInt() in.nextInt in int n = in.nextInt(); n in.nextInt() in.nextInt in int[] lines = new int[size]; lines new int[size] size int a a b; b for (int i = 0; i < lines.length; i++) {
			lines[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < lines.length i lines.length lines lines.length i++ i++ i {
			lines[i] = i + 1;
		} {
			lines[i] = i + 1;
		} lines[i] = i + 1 lines[i] lines i i + 1 i 1 for (int i = 0; i < n; i++) {
			String input = in.next();
			a = Integer.parseInt(input.split(",")[0]);
			b = Integer.parseInt(input.split(",")[1]);
			lines = swap(a, b, lines);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String input = in.next();
			a = Integer.parseInt(input.split(",")[0]);
			b = Integer.parseInt(input.split(",")[1]);
			lines = swap(a, b, lines);
		} {
			String input = in.next();
			a = Integer.parseInt(input.split(",")[0]);
			b = Integer.parseInt(input.split(",")[1]);
			lines = swap(a, b, lines);
		} String input = in.next(); input in.next() in.next in a = Integer.parseInt(input.split(",")[0]) a Integer.parseInt(input.split(",")[0]) Integer.parseInt Integer input.split(",")[0] input.split(",") input.split input "," 0 b = Integer.parseInt(input.split(",")[1]) b Integer.parseInt(input.split(",")[1]) Integer.parseInt Integer input.split(",")[1] input.split(",") input.split input "," 1 lines = swap(a, b, lines) lines swap(a, b, lines) swap a b lines for (int i = 0; i < lines.length; i++) {
			System.out.println(lines[i]);
		} int i = 0; int i = 0; i 0 i < lines.length i lines.length lines lines.length i++ i++ i {
			System.out.println(lines[i]);
		} {
			System.out.println(lines[i]);
		} System.out.println(lines[i]) System.out.println System.out System System.out lines[i] lines i in.close() in.close in String[] args args public static int[] swap(int a, int b, int[] lines) {
		int temp = lines[a - 1];
		lines[a - 1] = lines[b - 1];
		lines[b - 1] = temp;
		return lines;
	} swap {
		int temp = lines[a - 1];
		lines[a - 1] = lines[b - 1];
		lines[b - 1] = temp;
		return lines;
	} int temp = lines[a - 1]; temp lines[a - 1] lines a - 1 a 1 lines[a - 1] = lines[b - 1] lines[a - 1] lines a - 1 a 1 lines[b - 1] lines b - 1 b 1 lines[b - 1] = temp lines[b - 1] lines b - 1 b 1 temp return lines; lines int a a int b b int[] lines lines
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int size = in.nextInt();
		int n = in.nextInt();
		int[] lines = new int[size];
		int a, b;
		for (int i = 0; i < lines.length; i++) {
			lines[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String input = in.next();
			a = Integer.parseInt(input.split(",")[0]);
			b = Integer.parseInt(input.split(",")[1]);
			lines = swap(a, b, lines);
		}
		for (int i = 0; i < lines.length; i++) {
			System.out.println(lines[i]);
		}
		in.close();
	}

	public static int[] swap(int a, int b, int[] lines) {
		int temp = lines[a - 1];
		lines[a - 1] = lines[b - 1];
		lines[b - 1] = temp;
		return lines;
	}
}