import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] amida;
		amida = new int[w];
		for (int i = 0; i < amida.length; i ++) amida[i] = i + 1;
		for (int i = 0; i < n; i ++) {
			String line = scan.next();
			String[] ab = line.split(",", 0);
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			int swap = amida[a];
			amida[a] = amida[b];
			amida[b] = swap;
		}
		for (int i = 0; i < w; i ++) System.out.printf("%d\n", amida[i]);
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] amida;
		amida = new int[w];
		for (int i = 0; i < amida.length; i ++) amida[i] = i + 1;
		for (int i = 0; i < n; i ++) {
			String line = scan.next();
			String[] ab = line.split(",", 0);
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			int swap = amida[a];
			amida[a] = amida[b];
			amida[b] = swap;
		}
		for (int i = 0; i < w; i ++) System.out.printf("%d\n", amida[i]);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] amida;
		amida = new int[w];
		for (int i = 0; i < amida.length; i ++) amida[i] = i + 1;
		for (int i = 0; i < n; i ++) {
			String line = scan.next();
			String[] ab = line.split(",", 0);
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			int swap = amida[a];
			amida[a] = amida[b];
			amida[b] = swap;
		}
		for (int i = 0; i < w; i ++) System.out.printf("%d\n", amida[i]);
	} main {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] amida;
		amida = new int[w];
		for (int i = 0; i < amida.length; i ++) amida[i] = i + 1;
		for (int i = 0; i < n; i ++) {
			String line = scan.next();
			String[] ab = line.split(",", 0);
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			int swap = amida[a];
			amida[a] = amida[b];
			amida[b] = swap;
		}
		for (int i = 0; i < w; i ++) System.out.printf("%d\n", amida[i]);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] amida; amida amida = new int[w] amida new int[w] w for (int i = 0; i < amida.length; i ++) amida[i] = i + 1; int i = 0; int i = 0; i 0 i < amida.length i amida.length amida amida.length i ++ i ++ i amida[i] = i + 1; amida[i] = i + 1 amida[i] amida i i + 1 i 1 for (int i = 0; i < n; i ++) {
			String line = scan.next();
			String[] ab = line.split(",", 0);
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			int swap = amida[a];
			amida[a] = amida[b];
			amida[b] = swap;
		} int i = 0; int i = 0; i 0 i < n i n i ++ i ++ i {
			String line = scan.next();
			String[] ab = line.split(",", 0);
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			int swap = amida[a];
			amida[a] = amida[b];
			amida[b] = swap;
		} {
			String line = scan.next();
			String[] ab = line.split(",", 0);
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			int swap = amida[a];
			amida[a] = amida[b];
			amida[b] = swap;
		} String line = scan.next(); line scan.next() scan.next scan String[] ab = line.split(",", 0); ab line.split(",", 0) line.split line "," 0 int a = Integer.parseInt(ab[0]) - 1; a Integer.parseInt(ab[0]) - 1 Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 1 int b = Integer.parseInt(ab[1]) - 1; b Integer.parseInt(ab[1]) - 1 Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 1 int swap = amida[a]; swap amida[a] amida a amida[a] = amida[b] amida[a] amida a amida[b] amida b amida[b] = swap amida[b] amida b swap for (int i = 0; i < w; i ++) System.out.printf("%d\n", amida[i]); int i = 0; int i = 0; i 0 i < w i w i ++ i ++ i System.out.printf("%d\n", amida[i]); System.out.printf("%d\n", amida[i]) System.out.printf System.out System System.out "%d\n" amida[i] amida i String[] args args
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] amida;
		amida = new int[w];
		for (int i = 0; i < amida.length; i ++) amida[i] = i + 1;
		for (int i = 0; i < n; i ++) {
			String line = scan.next();
			String[] ab = line.split(",", 0);
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			int swap = amida[a];
			amida[a] = amida[b];
			amida[b] = swap;
		}
		for (int i = 0; i < w; i ++) System.out.printf("%d\n", amida[i]);
	}
}