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

