import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] array = new int[w];
		for(int i = 0; i < w; i++){
			array[i] = i + 1;
		}
		for(int i = 0; i < n; i++){
			String[] split = sc.next().split(",", 0);
			int a = Integer.valueOf(split[0]) - 1;
			int b = Integer.valueOf(split[1]) - 1;
			int tmp = array[a];
			array[a] = array[b];
			array[b] = tmp;
		}

		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) throws Exception {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] array = new int[w];
		for(int i = 0; i < w; i++){
			array[i] = i + 1;
		}
		for(int i = 0; i < n; i++){
			String[] split = sc.next().split(",", 0);
			int a = Integer.valueOf(split[0]) - 1;
			int b = Integer.valueOf(split[1]) - 1;
			int tmp = array[a];
			array[a] = array[b];
			array[b] = tmp;
		}

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

	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] array = new int[w];
		for(int i = 0; i < w; i++){
			array[i] = i + 1;
		}
		for(int i = 0; i < n; i++){
			String[] split = sc.next().split(",", 0);
			int a = Integer.valueOf(split[0]) - 1;
			int b = Integer.valueOf(split[1]) - 1;
			int tmp = array[a];
			array[a] = array[b];
			array[b] = tmp;
		}

		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];
		for(int i = 0; i < w; i++){
			array[i] = i + 1;
		}
		for(int i = 0; i < n; i++){
			String[] split = sc.next().split(",", 0);
			int a = Integer.valueOf(split[0]) - 1;
			int b = Integer.valueOf(split[1]) - 1;
			int tmp = array[a];
			array[a] = array[b];
			array[b] = tmp;
		}

		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 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] = i + 1 array[i] array i i + 1 i 1 for(int i = 0; i < n; i++){
			String[] split = sc.next().split(",", 0);
			int a = Integer.valueOf(split[0]) - 1;
			int b = Integer.valueOf(split[1]) - 1;
			int tmp = array[a];
			array[a] = array[b];
			array[b] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String[] split = sc.next().split(",", 0);
			int a = Integer.valueOf(split[0]) - 1;
			int b = Integer.valueOf(split[1]) - 1;
			int tmp = array[a];
			array[a] = array[b];
			array[b] = tmp;
		} {
			String[] split = sc.next().split(",", 0);
			int a = Integer.valueOf(split[0]) - 1;
			int b = Integer.valueOf(split[1]) - 1;
			int tmp = array[a];
			array[a] = array[b];
			array[b] = tmp;
		} String[] split = sc.next().split(",", 0); split sc.next().split(",", 0) sc.next().split sc.next() sc.next sc "," 0 int a = Integer.valueOf(split[0]) - 1; a Integer.valueOf(split[0]) - 1 Integer.valueOf(split[0]) Integer.valueOf Integer split[0] split 0 1 int b = Integer.valueOf(split[1]) - 1; b Integer.valueOf(split[1]) - 1 Integer.valueOf(split[1]) Integer.valueOf Integer split[1] split 1 1 int tmp = array[a]; tmp array[a] array a array[a] = array[b] array[a] array a array[b] array b array[b] = tmp array[b] array b tmp 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) throws Exception {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] array = new int[w];
		for(int i = 0; i < w; i++){
			array[i] = i + 1;
		}
		for(int i = 0; i < n; i++){
			String[] split = sc.next().split(",", 0);
			int a = Integer.valueOf(split[0]) - 1;
			int b = Integer.valueOf(split[1]) - 1;
			int tmp = array[a];
			array[a] = array[b];
			array[b] = tmp;
		}

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

	}
} public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] array = new int[w];
		for(int i = 0; i < w; i++){
			array[i] = i + 1;
		}
		for(int i = 0; i < n; i++){
			String[] split = sc.next().split(",", 0);
			int a = Integer.valueOf(split[0]) - 1;
			int b = Integer.valueOf(split[1]) - 1;
			int tmp = array[a];
			array[a] = array[b];
			array[b] = tmp;
		}

		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) throws Exception {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] array = new int[w];
		for(int i = 0; i < w; i++){
			array[i] = i + 1;
		}
		for(int i = 0; i < n; i++){
			String[] split = sc.next().split(",", 0);
			int a = Integer.valueOf(split[0]) - 1;
			int b = Integer.valueOf(split[1]) - 1;
			int tmp = array[a];
			array[a] = array[b];
			array[b] = tmp;
		}

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

	}
}