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