import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int[] sticks = new int[w + 1];
		int n = sc.nextInt();

		for (int i = 1; i < sticks.length; i++)
			sticks[i] = i;
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			String[] swaps = str.split(",");
			int a = Integer.parseInt(swaps[0]);
			int b = Integer.parseInt(swaps[1]);
			int temp = sticks[b];
			sticks[b] = sticks[a];
			sticks[a] = temp;
		}
		for (int i = 1; i < sticks.length; i++)
			System.out.println(sticks[i]);

	}

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

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int[] sticks = new int[w + 1];
		int n = sc.nextInt();

		for (int i = 1; i < sticks.length; i++)
			sticks[i] = i;
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			String[] swaps = str.split(",");
			int a = Integer.parseInt(swaps[0]);
			int b = Integer.parseInt(swaps[1]);
			int temp = sticks[b];
			sticks[b] = sticks[a];
			sticks[a] = temp;
		}
		for (int i = 1; i < sticks.length; i++)
			System.out.println(sticks[i]);

	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int[] sticks = new int[w + 1];
		int n = sc.nextInt();

		for (int i = 1; i < sticks.length; i++)
			sticks[i] = i;
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			String[] swaps = str.split(",");
			int a = Integer.parseInt(swaps[0]);
			int b = Integer.parseInt(swaps[1]);
			int temp = sticks[b];
			sticks[b] = sticks[a];
			sticks[a] = temp;
		}
		for (int i = 1; i < sticks.length; i++)
			System.out.println(sticks[i]);

	} main {

		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int[] sticks = new int[w + 1];
		int n = sc.nextInt();

		for (int i = 1; i < sticks.length; i++)
			sticks[i] = i;
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			String[] swaps = str.split(",");
			int a = Integer.parseInt(swaps[0]);
			int b = Integer.parseInt(swaps[1]);
			int temp = sticks[b];
			sticks[b] = sticks[a];
			sticks[a] = temp;
		}
		for (int i = 1; i < sticks.length; i++)
			System.out.println(sticks[i]);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int[] sticks = new int[w + 1]; sticks new int[w + 1] w + 1 w 1 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for (int i = 1; i < sticks.length; i++)
			sticks[i] = i; int i = 1; int i = 1; i 1 i < sticks.length i sticks.length sticks sticks.length i++ i++ i sticks[i] = i; sticks[i] = i sticks[i] sticks i i for (int i = 0; i < n; i++) {
			String str = sc.next();
			String[] swaps = str.split(",");
			int a = Integer.parseInt(swaps[0]);
			int b = Integer.parseInt(swaps[1]);
			int temp = sticks[b];
			sticks[b] = sticks[a];
			sticks[a] = temp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String str = sc.next();
			String[] swaps = str.split(",");
			int a = Integer.parseInt(swaps[0]);
			int b = Integer.parseInt(swaps[1]);
			int temp = sticks[b];
			sticks[b] = sticks[a];
			sticks[a] = temp;
		} {
			String str = sc.next();
			String[] swaps = str.split(",");
			int a = Integer.parseInt(swaps[0]);
			int b = Integer.parseInt(swaps[1]);
			int temp = sticks[b];
			sticks[b] = sticks[a];
			sticks[a] = temp;
		} String str = sc.next(); str sc.next() sc.next sc String[] swaps = str.split(","); swaps str.split(",") str.split str "," int a = Integer.parseInt(swaps[0]); a Integer.parseInt(swaps[0]) Integer.parseInt Integer swaps[0] swaps 0 int b = Integer.parseInt(swaps[1]); b Integer.parseInt(swaps[1]) Integer.parseInt Integer swaps[1] swaps 1 int temp = sticks[b]; temp sticks[b] sticks b sticks[b] = sticks[a] sticks[b] sticks b sticks[a] sticks a sticks[a] = temp sticks[a] sticks a temp for (int i = 1; i < sticks.length; i++)
			System.out.println(sticks[i]); int i = 1; int i = 1; i 1 i < sticks.length i sticks.length sticks sticks.length i++ i++ i System.out.println(sticks[i]); System.out.println(sticks[i]) System.out.println System.out System System.out sticks[i] sticks i String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int[] sticks = new int[w + 1];
		int n = sc.nextInt();

		for (int i = 1; i < sticks.length; i++)
			sticks[i] = i;
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			String[] swaps = str.split(",");
			int a = Integer.parseInt(swaps[0]);
			int b = Integer.parseInt(swaps[1]);
			int temp = sticks[b];
			sticks[b] = sticks[a];
			sticks[a] = temp;
		}
		for (int i = 1; i < sticks.length; i++)
			System.out.println(sticks[i]);

	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int[] sticks = new int[w + 1];
		int n = sc.nextInt();

		for (int i = 1; i < sticks.length; i++)
			sticks[i] = i;
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			String[] swaps = str.split(",");
			int a = Integer.parseInt(swaps[0]);
			int b = Integer.parseInt(swaps[1]);
			int temp = sticks[b];
			sticks[b] = sticks[a];
			sticks[a] = temp;
		}
		for (int i = 1; i < sticks.length; i++)
			System.out.println(sticks[i]);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int[] sticks = new int[w + 1];
		int n = sc.nextInt();

		for (int i = 1; i < sticks.length; i++)
			sticks[i] = i;
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			String[] swaps = str.split(",");
			int a = Integer.parseInt(swaps[0]);
			int b = Integer.parseInt(swaps[1]);
			int temp = sticks[b];
			sticks[b] = sticks[a];
			sticks[a] = temp;
		}
		for (int i = 1; i < sticks.length; i++)
			System.out.println(sticks[i]);

	}

}