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