import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] x = new int[w];
		String empty = sc.nextLine();

		for (int i = 0; i < x.length; i++) {
			x[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			String str = sc.nextLine();
			String ints[] = str.split(",", 0);
			int a = Integer.parseInt(ints[0]) - 1;
			int b = Integer.parseInt(ints[1]) - 1;
			Swap(a, b, x);
		}
		for (int i = 0; i < x.length; i++) {
			System.out.printf("%d\n", x[i]);
		}
	}

	private static void Swap(int a, int b, int[] x) {
		// TODO Auto-generated method stub
		int tmp = 0;
		tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] x = new int[w];
		String empty = sc.nextLine();

		for (int i = 0; i < x.length; i++) {
			x[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			String str = sc.nextLine();
			String ints[] = str.split(",", 0);
			int a = Integer.parseInt(ints[0]) - 1;
			int b = Integer.parseInt(ints[1]) - 1;
			Swap(a, b, x);
		}
		for (int i = 0; i < x.length; i++) {
			System.out.printf("%d\n", x[i]);
		}
	}

	private static void Swap(int a, int b, int[] x) {
		// TODO Auto-generated method stub
		int tmp = 0;
		tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] x = new int[w];
		String empty = sc.nextLine();

		for (int i = 0; i < x.length; i++) {
			x[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			String str = sc.nextLine();
			String ints[] = str.split(",", 0);
			int a = Integer.parseInt(ints[0]) - 1;
			int b = Integer.parseInt(ints[1]) - 1;
			Swap(a, b, x);
		}
		for (int i = 0; i < x.length; i++) {
			System.out.printf("%d\n", x[i]);
		}
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] x = new int[w];
		String empty = sc.nextLine();

		for (int i = 0; i < x.length; i++) {
			x[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			String str = sc.nextLine();
			String ints[] = str.split(",", 0);
			int a = Integer.parseInt(ints[0]) - 1;
			int b = Integer.parseInt(ints[1]) - 1;
			Swap(a, b, x);
		}
		for (int i = 0; i < x.length; i++) {
			System.out.printf("%d\n", x[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] x = new int[w]; x new int[w] w String empty = sc.nextLine(); empty sc.nextLine() sc.nextLine sc for (int i = 0; i < x.length; i++) {
			x[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < x.length i x.length x x.length i++ i++ i {
			x[i] = i + 1;
		} {
			x[i] = i + 1;
		} x[i] = i + 1 x[i] x i i + 1 i 1 for (int i = 0; i < n; i++) {
			String str = sc.nextLine();
			String ints[] = str.split(",", 0);
			int a = Integer.parseInt(ints[0]) - 1;
			int b = Integer.parseInt(ints[1]) - 1;
			Swap(a, b, x);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String str = sc.nextLine();
			String ints[] = str.split(",", 0);
			int a = Integer.parseInt(ints[0]) - 1;
			int b = Integer.parseInt(ints[1]) - 1;
			Swap(a, b, x);
		} {
			String str = sc.nextLine();
			String ints[] = str.split(",", 0);
			int a = Integer.parseInt(ints[0]) - 1;
			int b = Integer.parseInt(ints[1]) - 1;
			Swap(a, b, x);
		} String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String ints[] = str.split(",", 0); ints str.split(",", 0) str.split str "," 0 int a = Integer.parseInt(ints[0]) - 1; a Integer.parseInt(ints[0]) - 1 Integer.parseInt(ints[0]) Integer.parseInt Integer ints[0] ints 0 1 int b = Integer.parseInt(ints[1]) - 1; b Integer.parseInt(ints[1]) - 1 Integer.parseInt(ints[1]) Integer.parseInt Integer ints[1] ints 1 1 Swap(a, b, x) Swap a b x for (int i = 0; i < x.length; i++) {
			System.out.printf("%d\n", x[i]);
		} int i = 0; int i = 0; i 0 i < x.length i x.length x x.length i++ i++ i {
			System.out.printf("%d\n", x[i]);
		} {
			System.out.printf("%d\n", x[i]);
		} System.out.printf("%d\n", x[i]) System.out.printf System.out System System.out "%d\n" x[i] x i String[] args args private static void Swap(int a, int b, int[] x) {
		// TODO Auto-generated method stub
		int tmp = 0;
		tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	} Swap {
		// TODO Auto-generated method stub
		int tmp = 0;
		tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	} int tmp = 0; tmp 0 tmp = x[a] tmp x[a] x a x[a] = x[b] x[a] x a x[b] x b x[b] = tmp x[b] x b tmp int a a int b b int[] x x public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] x = new int[w];
		String empty = sc.nextLine();

		for (int i = 0; i < x.length; i++) {
			x[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			String str = sc.nextLine();
			String ints[] = str.split(",", 0);
			int a = Integer.parseInt(ints[0]) - 1;
			int b = Integer.parseInt(ints[1]) - 1;
			Swap(a, b, x);
		}
		for (int i = 0; i < x.length; i++) {
			System.out.printf("%d\n", x[i]);
		}
	}

	private static void Swap(int a, int b, int[] x) {
		// TODO Auto-generated method stub
		int tmp = 0;
		tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] x = new int[w];
		String empty = sc.nextLine();

		for (int i = 0; i < x.length; i++) {
			x[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			String str = sc.nextLine();
			String ints[] = str.split(",", 0);
			int a = Integer.parseInt(ints[0]) - 1;
			int b = Integer.parseInt(ints[1]) - 1;
			Swap(a, b, x);
		}
		for (int i = 0; i < x.length; i++) {
			System.out.printf("%d\n", x[i]);
		}
	}

	private static void Swap(int a, int b, int[] x) {
		// TODO Auto-generated method stub
		int tmp = 0;
		tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] x = new int[w];
		String empty = sc.nextLine();

		for (int i = 0; i < x.length; i++) {
			x[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			String str = sc.nextLine();
			String ints[] = str.split(",", 0);
			int a = Integer.parseInt(ints[0]) - 1;
			int b = Integer.parseInt(ints[1]) - 1;
			Swap(a, b, x);
		}
		for (int i = 0; i < x.length; i++) {
			System.out.printf("%d\n", x[i]);
		}
	}

	private static void Swap(int a, int b, int[] x) {
		// TODO Auto-generated method stub
		int tmp = 0;
		tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}

}