import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[w];
		int swap1, swap2;
		byte garbage;

		for(int i = 0;i < w;i++) array[i] = i + 1;

		for(int i = 0;i < n;i++){
//			String swap = sc.next();
			String[] swaps = sc.next().split(",", 0);

			swap1 = Integer.parseInt(swaps[0]) - 1;
			swap2 = Integer.parseInt(swaps[1]) - 1;

			int temp = array[swap1];
			array[swap1] = array[swap2];
			array[swap2] = temp;
		}

		for(int i = 0;i < w;i++){
			System.out.println(array[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 n = sc.nextInt();
		int[] array = new int[w];
		int swap1, swap2;
		byte garbage;

		for(int i = 0;i < w;i++) array[i] = i + 1;

		for(int i = 0;i < n;i++){
//			String swap = sc.next();
			String[] swaps = sc.next().split(",", 0);

			swap1 = Integer.parseInt(swaps[0]) - 1;
			swap2 = Integer.parseInt(swaps[1]) - 1;

			int temp = array[swap1];
			array[swap1] = array[swap2];
			array[swap2] = temp;
		}

		for(int i = 0;i < w;i++){
			System.out.println(array[i]);
		}

	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[w];
		int swap1, swap2;
		byte garbage;

		for(int i = 0;i < w;i++) array[i] = i + 1;

		for(int i = 0;i < n;i++){
//			String swap = sc.next();
			String[] swaps = sc.next().split(",", 0);

			swap1 = Integer.parseInt(swaps[0]) - 1;
			swap2 = Integer.parseInt(swaps[1]) - 1;

			int temp = array[swap1];
			array[swap1] = array[swap2];
			array[swap2] = temp;
		}

		for(int i = 0;i < w;i++){
			System.out.println(array[i]);
		}

	} main {
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[w];
		int swap1, swap2;
		byte garbage;

		for(int i = 0;i < w;i++) array[i] = i + 1;

		for(int i = 0;i < n;i++){
//			String swap = sc.next();
			String[] swaps = sc.next().split(",", 0);

			swap1 = Integer.parseInt(swaps[0]) - 1;
			swap2 = Integer.parseInt(swaps[1]) - 1;

			int temp = array[swap1];
			array[swap1] = array[swap2];
			array[swap2] = temp;
		}

		for(int i = 0;i < w;i++){
			System.out.println(array[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[] array = new int[w]; array new int[w] w int swap1 swap1 swap2; swap2 byte garbage; garbage for(int i = 0;i < w;i++) array[i] = i + 1; int i = 0; int i = 0; i 0 i < w i w i++ i++ i array[i] = i + 1; array[i] = i + 1 array[i] array i i + 1 i 1 for(int i = 0;i < n;i++){
//			String swap = sc.next();
			String[] swaps = sc.next().split(",", 0);

			swap1 = Integer.parseInt(swaps[0]) - 1;
			swap2 = Integer.parseInt(swaps[1]) - 1;

			int temp = array[swap1];
			array[swap1] = array[swap2];
			array[swap2] = temp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
//			String swap = sc.next();
			String[] swaps = sc.next().split(",", 0);

			swap1 = Integer.parseInt(swaps[0]) - 1;
			swap2 = Integer.parseInt(swaps[1]) - 1;

			int temp = array[swap1];
			array[swap1] = array[swap2];
			array[swap2] = temp;
		} {
//			String swap = sc.next();
			String[] swaps = sc.next().split(",", 0);

			swap1 = Integer.parseInt(swaps[0]) - 1;
			swap2 = Integer.parseInt(swaps[1]) - 1;

			int temp = array[swap1];
			array[swap1] = array[swap2];
			array[swap2] = temp;
		} String[] swaps = sc.next().split(",", 0); swaps sc.next().split(",", 0) sc.next().split sc.next() sc.next sc "," 0 swap1 = Integer.parseInt(swaps[0]) - 1 swap1 Integer.parseInt(swaps[0]) - 1 Integer.parseInt(swaps[0]) Integer.parseInt Integer swaps[0] swaps 0 1 swap2 = Integer.parseInt(swaps[1]) - 1 swap2 Integer.parseInt(swaps[1]) - 1 Integer.parseInt(swaps[1]) Integer.parseInt Integer swaps[1] swaps 1 1 int temp = array[swap1]; temp array[swap1] array swap1 array[swap1] = array[swap2] array[swap1] array swap1 array[swap2] array swap2 array[swap2] = temp array[swap2] array swap2 temp for(int i = 0;i < w;i++){
			System.out.println(array[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(array[i]);
		} {
			System.out.println(array[i]);
		} System.out.println(array[i]) System.out.println System.out System System.out array[i] array i String[] args args public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[w];
		int swap1, swap2;
		byte garbage;

		for(int i = 0;i < w;i++) array[i] = i + 1;

		for(int i = 0;i < n;i++){
//			String swap = sc.next();
			String[] swaps = sc.next().split(",", 0);

			swap1 = Integer.parseInt(swaps[0]) - 1;
			swap2 = Integer.parseInt(swaps[1]) - 1;

			int temp = array[swap1];
			array[swap1] = array[swap2];
			array[swap2] = temp;
		}

		for(int i = 0;i < w;i++){
			System.out.println(array[i]);
		}

	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[w];
		int swap1, swap2;
		byte garbage;

		for(int i = 0;i < w;i++) array[i] = i + 1;

		for(int i = 0;i < n;i++){
//			String swap = sc.next();
			String[] swaps = sc.next().split(",", 0);

			swap1 = Integer.parseInt(swaps[0]) - 1;
			swap2 = Integer.parseInt(swaps[1]) - 1;

			int temp = array[swap1];
			array[swap1] = array[swap2];
			array[swap2] = temp;
		}

		for(int i = 0;i < w;i++){
			System.out.println(array[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 n = sc.nextInt();
		int[] array = new int[w];
		int swap1, swap2;
		byte garbage;

		for(int i = 0;i < w;i++) array[i] = i + 1;

		for(int i = 0;i < n;i++){
//			String swap = sc.next();
			String[] swaps = sc.next().split(",", 0);

			swap1 = Integer.parseInt(swaps[0]) - 1;
			swap2 = Integer.parseInt(swaps[1]) - 1;

			int temp = array[swap1];
			array[swap1] = array[swap2];
			array[swap2] = temp;
		}

		for(int i = 0;i < w;i++){
			System.out.println(array[i]);
		}

	}
}
