import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> array = new ArrayList<Integer>();

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

		for (int i = 1; i <= w; i++) {
			array.add(i);
		}

		//System.out.println(array);
		for (int j = 1; j <= n; j++) {
			String[] values = in.next().split(",");
			int a = Integer.parseInt(values[0]);
			int b = Integer.parseInt(values[1]);
			int c = array.get(a - 1);
			int d = array.get(b - 1);

			array.set(a - 1, d);
			array.set(b - 1, c);
		}

		for (int k = 0; k < w; k++) {
			int amida = array.get(k);
			System.out.println(amida);
		}
	}
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util public class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> array = new ArrayList<Integer>();

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

		for (int i = 1; i <= w; i++) {
			array.add(i);
		}

		//System.out.println(array);
		for (int j = 1; j <= n; j++) {
			String[] values = in.next().split(",");
			int a = Integer.parseInt(values[0]);
			int b = Integer.parseInt(values[1]);
			int c = array.get(a - 1);
			int d = array.get(b - 1);

			array.set(a - 1, d);
			array.set(b - 1, c);
		}

		for (int k = 0; k < w; k++) {
			int amida = array.get(k);
			System.out.println(amida);
		}
	}
} Main public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> array = new ArrayList<Integer>();

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

		for (int i = 1; i <= w; i++) {
			array.add(i);
		}

		//System.out.println(array);
		for (int j = 1; j <= n; j++) {
			String[] values = in.next().split(",");
			int a = Integer.parseInt(values[0]);
			int b = Integer.parseInt(values[1]);
			int c = array.get(a - 1);
			int d = array.get(b - 1);

			array.set(a - 1, d);
			array.set(b - 1, c);
		}

		for (int k = 0; k < w; k++) {
			int amida = array.get(k);
			System.out.println(amida);
		}
	} main {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> array = new ArrayList<Integer>();

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

		for (int i = 1; i <= w; i++) {
			array.add(i);
		}

		//System.out.println(array);
		for (int j = 1; j <= n; j++) {
			String[] values = in.next().split(",");
			int a = Integer.parseInt(values[0]);
			int b = Integer.parseInt(values[1]);
			int c = array.get(a - 1);
			int d = array.get(b - 1);

			array.set(a - 1, d);
			array.set(b - 1, c);
		}

		for (int k = 0; k < w; k++) {
			int amida = array.get(k);
			System.out.println(amida);
		}
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) ArrayList<Integer> array = new ArrayList<Integer>(); array new ArrayList<Integer>() int w = in.nextInt(); w in.nextInt() in.nextInt in int n = in.nextInt(); n in.nextInt() in.nextInt in for (int i = 1; i <= w; i++) {
			array.add(i);
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			array.add(i);
		} {
			array.add(i);
		} array.add(i) array.add array i for (int j = 1; j <= n; j++) {
			String[] values = in.next().split(",");
			int a = Integer.parseInt(values[0]);
			int b = Integer.parseInt(values[1]);
			int c = array.get(a - 1);
			int d = array.get(b - 1);

			array.set(a - 1, d);
			array.set(b - 1, c);
		} int j = 1; int j = 1; j 1 j <= n j n j++ j++ j {
			String[] values = in.next().split(",");
			int a = Integer.parseInt(values[0]);
			int b = Integer.parseInt(values[1]);
			int c = array.get(a - 1);
			int d = array.get(b - 1);

			array.set(a - 1, d);
			array.set(b - 1, c);
		} {
			String[] values = in.next().split(",");
			int a = Integer.parseInt(values[0]);
			int b = Integer.parseInt(values[1]);
			int c = array.get(a - 1);
			int d = array.get(b - 1);

			array.set(a - 1, d);
			array.set(b - 1, c);
		} String[] values = in.next().split(","); values in.next().split(",") in.next().split in.next() in.next in "," int a = Integer.parseInt(values[0]); a Integer.parseInt(values[0]) Integer.parseInt Integer values[0] values 0 int b = Integer.parseInt(values[1]); b Integer.parseInt(values[1]) Integer.parseInt Integer values[1] values 1 int c = array.get(a - 1); c array.get(a - 1) array.get array a - 1 a 1 int d = array.get(b - 1); d array.get(b - 1) array.get array b - 1 b 1 array.set(a - 1, d) array.set array a - 1 a 1 d array.set(b - 1, c) array.set array b - 1 b 1 c for (int k = 0; k < w; k++) {
			int amida = array.get(k);
			System.out.println(amida);
		} int k = 0; int k = 0; k 0 k < w k w k++ k++ k {
			int amida = array.get(k);
			System.out.println(amida);
		} {
			int amida = array.get(k);
			System.out.println(amida);
		} int amida = array.get(k); amida array.get(k) array.get array k System.out.println(amida) System.out.println System.out System System.out amida String args[] args public class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> array = new ArrayList<Integer>();

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

		for (int i = 1; i <= w; i++) {
			array.add(i);
		}

		//System.out.println(array);
		for (int j = 1; j <= n; j++) {
			String[] values = in.next().split(",");
			int a = Integer.parseInt(values[0]);
			int b = Integer.parseInt(values[1]);
			int c = array.get(a - 1);
			int d = array.get(b - 1);

			array.set(a - 1, d);
			array.set(b - 1, c);
		}

		for (int k = 0; k < w; k++) {
			int amida = array.get(k);
			System.out.println(amida);
		}
	}
} public class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> array = new ArrayList<Integer>();

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

		for (int i = 1; i <= w; i++) {
			array.add(i);
		}

		//System.out.println(array);
		for (int j = 1; j <= n; j++) {
			String[] values = in.next().split(",");
			int a = Integer.parseInt(values[0]);
			int b = Integer.parseInt(values[1]);
			int c = array.get(a - 1);
			int d = array.get(b - 1);

			array.set(a - 1, d);
			array.set(b - 1, c);
		}

		for (int k = 0; k < w; k++) {
			int amida = array.get(k);
			System.out.println(amida);
		}
	}
} Main
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> array = new ArrayList<Integer>();

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

		for (int i = 1; i <= w; i++) {
			array.add(i);
		}

		//System.out.println(array);
		for (int j = 1; j <= n; j++) {
			String[] values = in.next().split(",");
			int a = Integer.parseInt(values[0]);
			int b = Integer.parseInt(values[1]);
			int c = array.get(a - 1);
			int d = array.get(b - 1);

			array.set(a - 1, d);
			array.set(b - 1, c);
		}

		for (int k = 0; k < w; k++) {
			int amida = array.get(k);
			System.out.println(amida);
		}
	}
}