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[] s = new int[w];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String line = sc.next();
			String[] ss = line.split(",");
			int a = Integer.parseInt(ss[0]);
			int b = Integer.parseInt(ss[1]);
			int c = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = c;
		}
		for (int i = 0; i < w; i++) {
			System.out.println(s[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[] s = new int[w];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String line = sc.next();
			String[] ss = line.split(",");
			int a = Integer.parseInt(ss[0]);
			int b = Integer.parseInt(ss[1]);
			int c = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = c;
		}
		for (int i = 0; i < w; i++) {
			System.out.println(s[i]);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] s = new int[w];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String line = sc.next();
			String[] ss = line.split(",");
			int a = Integer.parseInt(ss[0]);
			int b = Integer.parseInt(ss[1]);
			int c = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = c;
		}
		for (int i = 0; i < w; i++) {
			System.out.println(s[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] s = new int[w];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String line = sc.next();
			String[] ss = line.split(",");
			int a = Integer.parseInt(ss[0]);
			int b = Integer.parseInt(ss[1]);
			int c = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = c;
		}
		for (int i = 0; i < w; i++) {
			System.out.println(s[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[] s = new int[w]; s new int[w] w for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			s[i] = i + 1;
		} {
			s[i] = i + 1;
		} s[i] = i + 1 s[i] s i i + 1 i 1 for (int i = 0; i < n; i++) {
			String line = sc.next();
			String[] ss = line.split(",");
			int a = Integer.parseInt(ss[0]);
			int b = Integer.parseInt(ss[1]);
			int c = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = c;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String line = sc.next();
			String[] ss = line.split(",");
			int a = Integer.parseInt(ss[0]);
			int b = Integer.parseInt(ss[1]);
			int c = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = c;
		} {
			String line = sc.next();
			String[] ss = line.split(",");
			int a = Integer.parseInt(ss[0]);
			int b = Integer.parseInt(ss[1]);
			int c = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = c;
		} String line = sc.next(); line sc.next() sc.next sc String[] ss = line.split(","); ss line.split(",") line.split line "," int a = Integer.parseInt(ss[0]); a Integer.parseInt(ss[0]) Integer.parseInt Integer ss[0] ss 0 int b = Integer.parseInt(ss[1]); b Integer.parseInt(ss[1]) Integer.parseInt Integer ss[1] ss 1 int c = s[a - 1]; c s[a - 1] s a - 1 a 1 s[a - 1] = s[b - 1] s[a - 1] s a - 1 a 1 s[b - 1] s b - 1 b 1 s[b - 1] = c s[b - 1] s b - 1 b 1 c for (int i = 0; i < w; i++) {
			System.out.println(s[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(s[i]);
		} {
			System.out.println(s[i]);
		} System.out.println(s[i]) System.out.println System.out System System.out s[i] s 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[] s = new int[w];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String line = sc.next();
			String[] ss = line.split(",");
			int a = Integer.parseInt(ss[0]);
			int b = Integer.parseInt(ss[1]);
			int c = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = c;
		}
		for (int i = 0; i < w; i++) {
			System.out.println(s[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[] s = new int[w];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String line = sc.next();
			String[] ss = line.split(",");
			int a = Integer.parseInt(ss[0]);
			int b = Integer.parseInt(ss[1]);
			int c = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = c;
		}
		for (int i = 0; i < w; i++) {
			System.out.println(s[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[] s = new int[w];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			String line = sc.next();
			String[] ss = line.split(",");
			int a = Integer.parseInt(ss[0]);
			int b = Integer.parseInt(ss[1]);
			int c = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = c;
		}
		for (int i = 0; i < w; i++) {
			System.out.println(s[i]);
		}
	}
}