import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w, n, a, b, i, swap;
		String str;
		w = scan.nextInt();
		int[] amidakuji = new int[w];
		n = scan.nextInt();
		for (i = 0; i < w; i ++) amidakuji[i] = i;
		for (i = 0; i < n; i ++) {
			str = scan.next();
//			a = scan.nextInt();
//			b = scan.nextInt();
			String[] seisuu = str.split(",", 0);
			a = Integer.parseInt(seisuu[0]);
			b = Integer.parseInt(seisuu[1]);
			a --; b --;
			swap = amidakuji[a]; amidakuji[a] = amidakuji[b]; amidakuji[b] = swap;
		}
		for (i = 0; i < w; i ++) {
			System.out.println(amidakuji[i] + 1);
		}
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w, n, a, b, i, swap;
		String str;
		w = scan.nextInt();
		int[] amidakuji = new int[w];
		n = scan.nextInt();
		for (i = 0; i < w; i ++) amidakuji[i] = i;
		for (i = 0; i < n; i ++) {
			str = scan.next();
//			a = scan.nextInt();
//			b = scan.nextInt();
			String[] seisuu = str.split(",", 0);
			a = Integer.parseInt(seisuu[0]);
			b = Integer.parseInt(seisuu[1]);
			a --; b --;
			swap = amidakuji[a]; amidakuji[a] = amidakuji[b]; amidakuji[b] = swap;
		}
		for (i = 0; i < w; i ++) {
			System.out.println(amidakuji[i] + 1);
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w, n, a, b, i, swap;
		String str;
		w = scan.nextInt();
		int[] amidakuji = new int[w];
		n = scan.nextInt();
		for (i = 0; i < w; i ++) amidakuji[i] = i;
		for (i = 0; i < n; i ++) {
			str = scan.next();
//			a = scan.nextInt();
//			b = scan.nextInt();
			String[] seisuu = str.split(",", 0);
			a = Integer.parseInt(seisuu[0]);
			b = Integer.parseInt(seisuu[1]);
			a --; b --;
			swap = amidakuji[a]; amidakuji[a] = amidakuji[b]; amidakuji[b] = swap;
		}
		for (i = 0; i < w; i ++) {
			System.out.println(amidakuji[i] + 1);
		}
	} main {
		Scanner scan = new Scanner(System.in);
		int w, n, a, b, i, swap;
		String str;
		w = scan.nextInt();
		int[] amidakuji = new int[w];
		n = scan.nextInt();
		for (i = 0; i < w; i ++) amidakuji[i] = i;
		for (i = 0; i < n; i ++) {
			str = scan.next();
//			a = scan.nextInt();
//			b = scan.nextInt();
			String[] seisuu = str.split(",", 0);
			a = Integer.parseInt(seisuu[0]);
			b = Integer.parseInt(seisuu[1]);
			a --; b --;
			swap = amidakuji[a]; amidakuji[a] = amidakuji[b]; amidakuji[b] = swap;
		}
		for (i = 0; i < w; i ++) {
			System.out.println(amidakuji[i] + 1);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w w n n a a b b i i swap; swap String str; str w = scan.nextInt() w scan.nextInt() scan.nextInt scan int[] amidakuji = new int[w]; amidakuji new int[w] w n = scan.nextInt() n scan.nextInt() scan.nextInt scan for (i = 0; i < w; i ++) amidakuji[i] = i; i = 0; i = 0 i 0 i < w i w i ++ i ++ i amidakuji[i] = i; amidakuji[i] = i amidakuji[i] amidakuji i i for (i = 0; i < n; i ++) {
			str = scan.next();
//			a = scan.nextInt();
//			b = scan.nextInt();
			String[] seisuu = str.split(",", 0);
			a = Integer.parseInt(seisuu[0]);
			b = Integer.parseInt(seisuu[1]);
			a --; b --;
			swap = amidakuji[a]; amidakuji[a] = amidakuji[b]; amidakuji[b] = swap;
		} i = 0; i = 0 i 0 i < n i n i ++ i ++ i {
			str = scan.next();
//			a = scan.nextInt();
//			b = scan.nextInt();
			String[] seisuu = str.split(",", 0);
			a = Integer.parseInt(seisuu[0]);
			b = Integer.parseInt(seisuu[1]);
			a --; b --;
			swap = amidakuji[a]; amidakuji[a] = amidakuji[b]; amidakuji[b] = swap;
		} {
			str = scan.next();
//			a = scan.nextInt();
//			b = scan.nextInt();
			String[] seisuu = str.split(",", 0);
			a = Integer.parseInt(seisuu[0]);
			b = Integer.parseInt(seisuu[1]);
			a --; b --;
			swap = amidakuji[a]; amidakuji[a] = amidakuji[b]; amidakuji[b] = swap;
		} str = scan.next() str scan.next() scan.next scan String[] seisuu = str.split(",", 0); seisuu str.split(",", 0) str.split str "," 0 a = Integer.parseInt(seisuu[0]) a Integer.parseInt(seisuu[0]) Integer.parseInt Integer seisuu[0] seisuu 0 b = Integer.parseInt(seisuu[1]) b Integer.parseInt(seisuu[1]) Integer.parseInt Integer seisuu[1] seisuu 1 a -- a b -- b swap = amidakuji[a] swap amidakuji[a] amidakuji a amidakuji[a] = amidakuji[b] amidakuji[a] amidakuji a amidakuji[b] amidakuji b amidakuji[b] = swap amidakuji[b] amidakuji b swap for (i = 0; i < w; i ++) {
			System.out.println(amidakuji[i] + 1);
		} i = 0; i = 0 i 0 i < w i w i ++ i ++ i {
			System.out.println(amidakuji[i] + 1);
		} {
			System.out.println(amidakuji[i] + 1);
		} System.out.println(amidakuji[i] + 1) System.out.println System.out System System.out amidakuji[i] + 1 amidakuji[i] amidakuji i 1 String[] args args
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w, n, a, b, i, swap;
		String str;
		w = scan.nextInt();
		int[] amidakuji = new int[w];
		n = scan.nextInt();
		for (i = 0; i < w; i ++) amidakuji[i] = i;
		for (i = 0; i < n; i ++) {
			str = scan.next();
//			a = scan.nextInt();
//			b = scan.nextInt();
			String[] seisuu = str.split(",", 0);
			a = Integer.parseInt(seisuu[0]);
			b = Integer.parseInt(seisuu[1]);
			a --; b --;
			swap = amidakuji[a]; amidakuji[a] = amidakuji[b]; amidakuji[b] = swap;
		}
		for (i = 0; i < w; i ++) {
			System.out.println(amidakuji[i] + 1);
		}
	}
}