import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
//		sc.useDelimiter("\\r*\\n*,*");
//		int a = sc.nextInt();
//		int b = sc.nextInt();
//		System.out.println(a);
//		System.out.println(b);
		int vl = sc.nextInt();
		int[] state = new int[vl+1];
		for (int i=1; i <= vl; i++) {
			state[i] = i;
		}

		int hl = sc.nextInt();
		sc.nextLine();
		for (int i=0; i < hl; i++) {
			String[] line = sc.nextLine().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			amida(state, a, b);
		}

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

	public static void amida(int[] state, int pa, int pb) {
		int temp;
		temp = state[pa];
		state[pa] = state[pb];
		state[pb] = temp;
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
//		sc.useDelimiter("\\r*\\n*,*");
//		int a = sc.nextInt();
//		int b = sc.nextInt();
//		System.out.println(a);
//		System.out.println(b);
		int vl = sc.nextInt();
		int[] state = new int[vl+1];
		for (int i=1; i <= vl; i++) {
			state[i] = i;
		}

		int hl = sc.nextInt();
		sc.nextLine();
		for (int i=0; i < hl; i++) {
			String[] line = sc.nextLine().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			amida(state, a, b);
		}

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

	public static void amida(int[] state, int pa, int pb) {
		int temp;
		temp = state[pa];
		state[pa] = state[pb];
		state[pb] = temp;
	}
} Main public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
//		sc.useDelimiter("\\r*\\n*,*");
//		int a = sc.nextInt();
//		int b = sc.nextInt();
//		System.out.println(a);
//		System.out.println(b);
		int vl = sc.nextInt();
		int[] state = new int[vl+1];
		for (int i=1; i <= vl; i++) {
			state[i] = i;
		}

		int hl = sc.nextInt();
		sc.nextLine();
		for (int i=0; i < hl; i++) {
			String[] line = sc.nextLine().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			amida(state, a, b);
		}

		for (int i=1; i <= vl; i++) {
			System.out.println(state[i]);
		}
	} main {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
//		sc.useDelimiter("\\r*\\n*,*");
//		int a = sc.nextInt();
//		int b = sc.nextInt();
//		System.out.println(a);
//		System.out.println(b);
		int vl = sc.nextInt();
		int[] state = new int[vl+1];
		for (int i=1; i <= vl; i++) {
			state[i] = i;
		}

		int hl = sc.nextInt();
		sc.nextLine();
		for (int i=0; i < hl; i++) {
			String[] line = sc.nextLine().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			amida(state, a, b);
		}

		for (int i=1; i <= vl; i++) {
			System.out.println(state[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int vl = sc.nextInt(); vl sc.nextInt() sc.nextInt sc int[] state = new int[vl+1]; state new int[vl+1] vl+1 vl 1 for (int i=1; i <= vl; i++) {
			state[i] = i;
		} int i=1; int i=1; i 1 i <= vl i vl i++ i++ i {
			state[i] = i;
		} {
			state[i] = i;
		} state[i] = i state[i] state i i int hl = sc.nextInt(); hl sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc for (int i=0; i < hl; i++) {
			String[] line = sc.nextLine().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			amida(state, a, b);
		} int i=0; int i=0; i 0 i < hl i hl i++ i++ i {
			String[] line = sc.nextLine().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			amida(state, a, b);
		} {
			String[] line = sc.nextLine().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			amida(state, a, b);
		} String[] line = sc.nextLine().split(","); line sc.nextLine().split(",") sc.nextLine().split sc.nextLine() sc.nextLine sc "," int a = Integer.parseInt(line[0]); a Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int b = Integer.parseInt(line[1]); b Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 amida(state, a, b) amida state a b for (int i=1; i <= vl; i++) {
			System.out.println(state[i]);
		} int i=1; int i=1; i 1 i <= vl i vl i++ i++ i {
			System.out.println(state[i]);
		} {
			System.out.println(state[i]);
		} System.out.println(state[i]) System.out.println System.out System System.out state[i] state i String[] args args public static void amida(int[] state, int pa, int pb) {
		int temp;
		temp = state[pa];
		state[pa] = state[pb];
		state[pb] = temp;
	} amida {
		int temp;
		temp = state[pa];
		state[pa] = state[pb];
		state[pb] = temp;
	} int temp; temp temp = state[pa] temp state[pa] state pa state[pa] = state[pb] state[pa] state pa state[pb] state pb state[pb] = temp state[pb] state pb temp int[] state state int pa pa int pb pb public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
//		sc.useDelimiter("\\r*\\n*,*");
//		int a = sc.nextInt();
//		int b = sc.nextInt();
//		System.out.println(a);
//		System.out.println(b);
		int vl = sc.nextInt();
		int[] state = new int[vl+1];
		for (int i=1; i <= vl; i++) {
			state[i] = i;
		}

		int hl = sc.nextInt();
		sc.nextLine();
		for (int i=0; i < hl; i++) {
			String[] line = sc.nextLine().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			amida(state, a, b);
		}

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

	public static void amida(int[] state, int pa, int pb) {
		int temp;
		temp = state[pa];
		state[pa] = state[pb];
		state[pb] = temp;
	}
} public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
//		sc.useDelimiter("\\r*\\n*,*");
//		int a = sc.nextInt();
//		int b = sc.nextInt();
//		System.out.println(a);
//		System.out.println(b);
		int vl = sc.nextInt();
		int[] state = new int[vl+1];
		for (int i=1; i <= vl; i++) {
			state[i] = i;
		}

		int hl = sc.nextInt();
		sc.nextLine();
		for (int i=0; i < hl; i++) {
			String[] line = sc.nextLine().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			amida(state, a, b);
		}

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

	public static void amida(int[] state, int pa, int pb) {
		int temp;
		temp = state[pa];
		state[pa] = state[pb];
		state[pb] = temp;
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
//		sc.useDelimiter("\\r*\\n*,*");
//		int a = sc.nextInt();
//		int b = sc.nextInt();
//		System.out.println(a);
//		System.out.println(b);
		int vl = sc.nextInt();
		int[] state = new int[vl+1];
		for (int i=1; i <= vl; i++) {
			state[i] = i;
		}

		int hl = sc.nextInt();
		sc.nextLine();
		for (int i=0; i < hl; i++) {
			String[] line = sc.nextLine().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			amida(state, a, b);
		}

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

	public static void amida(int[] state, int pa, int pb) {
		int temp;
		temp = state[pa];
		state[pa] = state[pb];
		state[pb] = temp;
	}
}