import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int points[] = new int[w + 1];
		for (int i = 1; i <= w; ++i)
			points[i] = i;
		int n = sc.nextInt();
		sc.useDelimiter(",|\n");
		for (int i = 0; i < n; ++i) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int tmp = points[a];
			points[a] = points[b];
			points[b] = tmp;
		}
		for (int i = 1; i <= w; ++i)
			System.out.println(points[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 points[] = new int[w + 1];
		for (int i = 1; i <= w; ++i)
			points[i] = i;
		int n = sc.nextInt();
		sc.useDelimiter(",|\n");
		for (int i = 0; i < n; ++i) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int tmp = points[a];
			points[a] = points[b];
			points[b] = tmp;
		}
		for (int i = 1; i <= w; ++i)
			System.out.println(points[i]);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int points[] = new int[w + 1];
		for (int i = 1; i <= w; ++i)
			points[i] = i;
		int n = sc.nextInt();
		sc.useDelimiter(",|\n");
		for (int i = 0; i < n; ++i) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int tmp = points[a];
			points[a] = points[b];
			points[b] = tmp;
		}
		for (int i = 1; i <= w; ++i)
			System.out.println(points[i]);
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int points[] = new int[w + 1];
		for (int i = 1; i <= w; ++i)
			points[i] = i;
		int n = sc.nextInt();
		sc.useDelimiter(",|\n");
		for (int i = 0; i < n; ++i) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int tmp = points[a];
			points[a] = points[b];
			points[b] = tmp;
		}
		for (int i = 1; i <= w; ++i)
			System.out.println(points[i]);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int points[] = new int[w + 1]; points new int[w + 1] w + 1 w 1 for (int i = 1; i <= w; ++i)
			points[i] = i; int i = 1; int i = 1; i 1 i <= w i w ++i ++i i points[i] = i; points[i] = i points[i] points i i int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc sc.useDelimiter(",|\n") sc.useDelimiter sc ",|\n" for (int i = 0; i < n; ++i) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int tmp = points[a];
			points[a] = points[b];
			points[b] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int tmp = points[a];
			points[a] = points[b];
			points[b] = tmp;
		} {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int tmp = points[a];
			points[a] = points[b];
			points[b] = tmp;
		} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int tmp = points[a]; tmp points[a] points a points[a] = points[b] points[a] points a points[b] points b points[b] = tmp points[b] points b tmp for (int i = 1; i <= w; ++i)
			System.out.println(points[i]); int i = 1; int i = 1; i 1 i <= w i w ++i ++i i System.out.println(points[i]); System.out.println(points[i]) System.out.println System.out System System.out points[i] points i String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int points[] = new int[w + 1];
		for (int i = 1; i <= w; ++i)
			points[i] = i;
		int n = sc.nextInt();
		sc.useDelimiter(",|\n");
		for (int i = 0; i < n; ++i) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int tmp = points[a];
			points[a] = points[b];
			points[b] = tmp;
		}
		for (int i = 1; i <= w; ++i)
			System.out.println(points[i]);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int points[] = new int[w + 1];
		for (int i = 1; i <= w; ++i)
			points[i] = i;
		int n = sc.nextInt();
		sc.useDelimiter(",|\n");
		for (int i = 0; i < n; ++i) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int tmp = points[a];
			points[a] = points[b];
			points[b] = tmp;
		}
		for (int i = 1; i <= w; ++i)
			System.out.println(points[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 points[] = new int[w + 1];
		for (int i = 1; i <= w; ++i)
			points[i] = i;
		int n = sc.nextInt();
		sc.useDelimiter(",|\n");
		for (int i = 0; i < n; ++i) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int tmp = points[a];
			points[a] = points[b];
			points[b] = tmp;
		}
		for (int i = 1; i <= w; ++i)
			System.out.println(points[i]);
	}
}
