
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int i;
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		int[] box = new int[w + 1];

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

		for (i = 0; i < n; i++) {
			String str = scanner.next();
			String[] ab = str.split(",");
			int tmp = box[Integer.parseInt(ab[1])];
			box[Integer.parseInt(ab[1])] = box[Integer.parseInt(ab[0])];
			box[Integer.parseInt(ab[0])] = tmp;
		}

		for (i = 0; i < w; i++) {
			System.out.println(box[i + 1]);
		}
		scanner.close();
	}

}
 import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int i;
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		int[] box = new int[w + 1];

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

		for (i = 0; i < n; i++) {
			String str = scanner.next();
			String[] ab = str.split(",");
			int tmp = box[Integer.parseInt(ab[1])];
			box[Integer.parseInt(ab[1])] = box[Integer.parseInt(ab[0])];
			box[Integer.parseInt(ab[0])] = tmp;
		}

		for (i = 0; i < w; i++) {
			System.out.println(box[i + 1]);
		}
		scanner.close();
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int i;
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		int[] box = new int[w + 1];

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

		for (i = 0; i < n; i++) {
			String str = scanner.next();
			String[] ab = str.split(",");
			int tmp = box[Integer.parseInt(ab[1])];
			box[Integer.parseInt(ab[1])] = box[Integer.parseInt(ab[0])];
			box[Integer.parseInt(ab[0])] = tmp;
		}

		for (i = 0; i < w; i++) {
			System.out.println(box[i + 1]);
		}
		scanner.close();
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int i;
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		int[] box = new int[w + 1];

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

		for (i = 0; i < n; i++) {
			String str = scanner.next();
			String[] ab = str.split(",");
			int tmp = box[Integer.parseInt(ab[1])];
			box[Integer.parseInt(ab[1])] = box[Integer.parseInt(ab[0])];
			box[Integer.parseInt(ab[0])] = tmp;
		}

		for (i = 0; i < w; i++) {
			System.out.println(box[i + 1]);
		}
		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int i; i int w = scanner.nextInt(); w scanner.nextInt() scanner.nextInt scanner int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] box = new int[w + 1]; box new int[w + 1] w + 1 w 1 for (i = 0; i < w; i++) {
			box[i + 1] = i + 1;
		} i = 0; i = 0 i 0 i < w i w i++ i++ i {
			box[i + 1] = i + 1;
		} {
			box[i + 1] = i + 1;
		} box[i + 1] = i + 1 box[i + 1] box i + 1 i 1 i + 1 i 1 for (i = 0; i < n; i++) {
			String str = scanner.next();
			String[] ab = str.split(",");
			int tmp = box[Integer.parseInt(ab[1])];
			box[Integer.parseInt(ab[1])] = box[Integer.parseInt(ab[0])];
			box[Integer.parseInt(ab[0])] = tmp;
		} i = 0; i = 0 i 0 i < n i n i++ i++ i {
			String str = scanner.next();
			String[] ab = str.split(",");
			int tmp = box[Integer.parseInt(ab[1])];
			box[Integer.parseInt(ab[1])] = box[Integer.parseInt(ab[0])];
			box[Integer.parseInt(ab[0])] = tmp;
		} {
			String str = scanner.next();
			String[] ab = str.split(",");
			int tmp = box[Integer.parseInt(ab[1])];
			box[Integer.parseInt(ab[1])] = box[Integer.parseInt(ab[0])];
			box[Integer.parseInt(ab[0])] = tmp;
		} String str = scanner.next(); str scanner.next() scanner.next scanner String[] ab = str.split(","); ab str.split(",") str.split str "," int tmp = box[Integer.parseInt(ab[1])]; tmp box[Integer.parseInt(ab[1])] box Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 box[Integer.parseInt(ab[1])] = box[Integer.parseInt(ab[0])] box[Integer.parseInt(ab[1])] box Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 box[Integer.parseInt(ab[0])] box Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 box[Integer.parseInt(ab[0])] = tmp box[Integer.parseInt(ab[0])] box Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 tmp for (i = 0; i < w; i++) {
			System.out.println(box[i + 1]);
		} i = 0; i = 0 i 0 i < w i w i++ i++ i {
			System.out.println(box[i + 1]);
		} {
			System.out.println(box[i + 1]);
		} System.out.println(box[i + 1]) System.out.println System.out System System.out box[i + 1] box i + 1 i 1 scanner.close() scanner.close scanner String[] args args public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int i;
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		int[] box = new int[w + 1];

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

		for (i = 0; i < n; i++) {
			String str = scanner.next();
			String[] ab = str.split(",");
			int tmp = box[Integer.parseInt(ab[1])];
			box[Integer.parseInt(ab[1])] = box[Integer.parseInt(ab[0])];
			box[Integer.parseInt(ab[0])] = tmp;
		}

		for (i = 0; i < w; i++) {
			System.out.println(box[i + 1]);
		}
		scanner.close();
	}

} public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int i;
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		int[] box = new int[w + 1];

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

		for (i = 0; i < n; i++) {
			String str = scanner.next();
			String[] ab = str.split(",");
			int tmp = box[Integer.parseInt(ab[1])];
			box[Integer.parseInt(ab[1])] = box[Integer.parseInt(ab[0])];
			box[Integer.parseInt(ab[0])] = tmp;
		}

		for (i = 0; i < w; i++) {
			System.out.println(box[i + 1]);
		}
		scanner.close();
	}

} Main

import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int i;
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		int[] box = new int[w + 1];

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

		for (i = 0; i < n; i++) {
			String str = scanner.next();
			String[] ab = str.split(",");
			int tmp = box[Integer.parseInt(ab[1])];
			box[Integer.parseInt(ab[1])] = box[Integer.parseInt(ab[0])];
			box[Integer.parseInt(ab[0])] = tmp;
		}

		for (i = 0; i < w; i++) {
			System.out.println(box[i + 1]);
		}
		scanner.close();
	}

}

