import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter("\\D");

		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] amida;
		amida = new int[w];

		for (int i = 0; i < w; i++) {
			amida[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			int t = amida[a-1];
			amida[a-1] = amida[b-1];
			amida[b-1] = t;
		}

		for (int i = 0; i < w; i++)
			System.out.printf("%d\n", amida[i]);

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter("\\D");

		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] amida;
		amida = new int[w];

		for (int i = 0; i < w; i++) {
			amida[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			int t = amida[a-1];
			amida[a-1] = amida[b-1];
			amida[b-1] = t;
		}

		for (int i = 0; i < w; i++)
			System.out.printf("%d\n", amida[i]);

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter("\\D");

		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] amida;
		amida = new int[w];

		for (int i = 0; i < w; i++) {
			amida[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			int t = amida[a-1];
			amida[a-1] = amida[b-1];
			amida[b-1] = t;
		}

		for (int i = 0; i < w; i++)
			System.out.printf("%d\n", amida[i]);

	} main {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter("\\D");

		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] amida;
		amida = new int[w];

		for (int i = 0; i < w; i++) {
			amida[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			int t = amida[a-1];
			amida[a-1] = amida[b-1];
			amida[b-1] = t;
		}

		for (int i = 0; i < w; i++)
			System.out.printf("%d\n", amida[i]);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) sc.useDelimiter("\\D") sc.useDelimiter sc "\\D" int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] amida; amida amida = new int[w] amida new int[w] w for (int i = 0; i < w; i++) {
			amida[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			amida[i] = i + 1;
		} {
			amida[i] = i + 1;
		} amida[i] = i + 1 amida[i] amida i i + 1 i 1 for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			int t = amida[a-1];
			amida[a-1] = amida[b-1];
			amida[b-1] = t;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int a = sc.nextInt();
			int b = sc.nextInt();

			int t = amida[a-1];
			amida[a-1] = amida[b-1];
			amida[b-1] = t;
		} {
			int a = sc.nextInt();
			int b = sc.nextInt();

			int t = amida[a-1];
			amida[a-1] = amida[b-1];
			amida[b-1] = t;
		} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int t = amida[a-1]; t amida[a-1] amida a-1 a 1 amida[a-1] = amida[b-1] amida[a-1] amida a-1 a 1 amida[b-1] amida b-1 b 1 amida[b-1] = t amida[b-1] amida b-1 b 1 t for (int i = 0; i < w; i++)
			System.out.printf("%d\n", amida[i]); int i = 0; int i = 0; i 0 i < w i w i++ i++ i System.out.printf("%d\n", amida[i]); System.out.printf("%d\n", amida[i]) System.out.printf System.out System System.out "%d\n" amida[i] amida i String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter("\\D");

		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] amida;
		amida = new int[w];

		for (int i = 0; i < w; i++) {
			amida[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			int t = amida[a-1];
			amida[a-1] = amida[b-1];
			amida[b-1] = t;
		}

		for (int i = 0; i < w; i++)
			System.out.printf("%d\n", amida[i]);

	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter("\\D");

		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] amida;
		amida = new int[w];

		for (int i = 0; i < w; i++) {
			amida[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			int t = amida[a-1];
			amida[a-1] = amida[b-1];
			amida[b-1] = t;
		}

		for (int i = 0; i < w; i++)
			System.out.printf("%d\n", amida[i]);

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter("\\D");

		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] amida;
		amida = new int[w];

		for (int i = 0; i < w; i++) {
			amida[i] = i + 1;
		}

		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			int t = amida[a-1];
			amida[a-1] = amida[b-1];
			amida[b-1] = t;
		}

		for (int i = 0; i < w; i++)
			System.out.printf("%d\n", amida[i]);

	}
}