import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int w = in.nextInt();
		int n = in.nextInt();

		int[] x = new int[w];
		for (int i=0; i<w; i++) {
			x[i] = i + 1;
		}

		while (n-- > 0) {
			String[] str = in.next().split(",");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}

		for (int ans : x) {
			System.out.println(ans);
		}
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
} import java.util.*; util.* java import java.io.*; io.* java import java.awt.geom.*; geom.* java.awt import java.math.*; math.* java public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int w = in.nextInt();
		int n = in.nextInt();

		int[] x = new int[w];
		for (int i=0; i<w; i++) {
			x[i] = i + 1;
		}

		while (n-- > 0) {
			String[] str = in.next().split(",");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}

		for (int ans : x) {
			System.out.println(ans);
		}
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
} Main static final Scanner in = new Scanner(System.in); in new Scanner(System.in) static final PrintWriter out = new PrintWriter(System.out,false); out new PrintWriter(System.out,false) static void solve() {
		int w = in.nextInt();
		int n = in.nextInt();

		int[] x = new int[w];
		for (int i=0; i<w; i++) {
			x[i] = i + 1;
		}

		while (n-- > 0) {
			String[] str = in.next().split(",");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}

		for (int ans : x) {
			System.out.println(ans);
		}
	} solve {
		int w = in.nextInt();
		int n = in.nextInt();

		int[] x = new int[w];
		for (int i=0; i<w; i++) {
			x[i] = i + 1;
		}

		while (n-- > 0) {
			String[] str = in.next().split(",");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}

		for (int ans : x) {
			System.out.println(ans);
		}
	} int w = in.nextInt(); w in.nextInt() in.nextInt in int n = in.nextInt(); n in.nextInt() in.nextInt in int[] x = new int[w]; x new int[w] w for (int i=0; i<w; i++) {
			x[i] = i + 1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			x[i] = i + 1;
		} {
			x[i] = i + 1;
		} x[i] = i + 1 x[i] x i i + 1 i 1 while (n-- > 0) {
			String[] str = in.next().split(",");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		} n-- > 0 n-- n 0 {
			String[] str = in.next().split(",");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		} String[] str = in.next().split(","); str in.next().split(",") in.next().split in.next() in.next in "," int a = Integer.parseInt(str[0]) - 1; a Integer.parseInt(str[0]) - 1 Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 1 int b = Integer.parseInt(str[1]) - 1; b Integer.parseInt(str[1]) - 1 Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 1 int t = x[a]; t x[a] x a x[a] = x[b] x[a] x a x[b] x b x[b] = t x[b] x b t for (int ans : x) {
			System.out.println(ans);
		} int ans x {
			System.out.println(ans);
		} {
			System.out.println(ans);
		} System.out.println(ans) System.out.println System.out System System.out ans public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	} main {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	} long start = System.currentTimeMillis(); start System.currentTimeMillis() System.currentTimeMillis System solve() solve out.flush() out.flush out long end = System.currentTimeMillis(); end System.currentTimeMillis() System.currentTimeMillis System in.close() in.close in out.close() out.close out String[] args args static void trace(Object... o) { System.out.println(Arrays.deepToString(o));} trace { System.out.println(Arrays.deepToString(o));} System.out.println(Arrays.deepToString(o)) System.out.println System.out System System.out Arrays.deepToString(o) Arrays.deepToString Arrays o Object... o o public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int w = in.nextInt();
		int n = in.nextInt();

		int[] x = new int[w];
		for (int i=0; i<w; i++) {
			x[i] = i + 1;
		}

		while (n-- > 0) {
			String[] str = in.next().split(",");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}

		for (int ans : x) {
			System.out.println(ans);
		}
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
} public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int w = in.nextInt();
		int n = in.nextInt();

		int[] x = new int[w];
		for (int i=0; i<w; i++) {
			x[i] = i + 1;
		}

		while (n-- > 0) {
			String[] str = in.next().split(",");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}

		for (int ans : x) {
			System.out.println(ans);
		}
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
} Main
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int w = in.nextInt();
		int n = in.nextInt();

		int[] x = new int[w];
		for (int i=0; i<w; i++) {
			x[i] = i + 1;
		}

		while (n-- > 0) {
			String[] str = in.next().split(",");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}

		for (int ans : x) {
			System.out.println(ans);
		}
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}