import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int w = sc.nextInt();
		int[] ints = new int[w];
		for (int i=0; i<w; i++) {
			ints[i] = i+1;
		}
		int n = sc.nextInt();
		String[] strs = new String[2];
		for (int i=0; i<n; i++) {
			strs = sc.next().split(",");
			int L = Integer.parseInt(strs[0]) - 1;
			int R = Integer.parseInt(strs[1]) - 1;
			int temp = ints[L];
			ints[L] = ints[R];
			ints[R] = temp;
		}
		for (int i=0; i<w; i++) {
			System.out.println(ints[i]);
		}
	}
} import java.util.*; util.* java public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int w = sc.nextInt();
		int[] ints = new int[w];
		for (int i=0; i<w; i++) {
			ints[i] = i+1;
		}
		int n = sc.nextInt();
		String[] strs = new String[2];
		for (int i=0; i<n; i++) {
			strs = sc.next().split(",");
			int L = Integer.parseInt(strs[0]) - 1;
			int R = Integer.parseInt(strs[1]) - 1;
			int temp = ints[L];
			ints[L] = ints[R];
			ints[R] = temp;
		}
		for (int i=0; i<w; i++) {
			System.out.println(ints[i]);
		}
	}
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		int w = sc.nextInt();
		int[] ints = new int[w];
		for (int i=0; i<w; i++) {
			ints[i] = i+1;
		}
		int n = sc.nextInt();
		String[] strs = new String[2];
		for (int i=0; i<n; i++) {
			strs = sc.next().split(",");
			int L = Integer.parseInt(strs[0]) - 1;
			int R = Integer.parseInt(strs[1]) - 1;
			int temp = ints[L];
			ints[L] = ints[R];
			ints[R] = temp;
		}
		for (int i=0; i<w; i++) {
			System.out.println(ints[i]);
		}
	} main {
		int w = sc.nextInt();
		int[] ints = new int[w];
		for (int i=0; i<w; i++) {
			ints[i] = i+1;
		}
		int n = sc.nextInt();
		String[] strs = new String[2];
		for (int i=0; i<n; i++) {
			strs = sc.next().split(",");
			int L = Integer.parseInt(strs[0]) - 1;
			int R = Integer.parseInt(strs[1]) - 1;
			int temp = ints[L];
			ints[L] = ints[R];
			ints[R] = temp;
		}
		for (int i=0; i<w; i++) {
			System.out.println(ints[i]);
		}
	} int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int[] ints = new int[w]; ints new int[w] w for (int i=0; i<w; i++) {
			ints[i] = i+1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			ints[i] = i+1;
		} {
			ints[i] = i+1;
		} ints[i] = i+1 ints[i] ints i i+1 i 1 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String[] strs = new String[2]; strs new String[2] 2 for (int i=0; i<n; i++) {
			strs = sc.next().split(",");
			int L = Integer.parseInt(strs[0]) - 1;
			int R = Integer.parseInt(strs[1]) - 1;
			int temp = ints[L];
			ints[L] = ints[R];
			ints[R] = temp;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			strs = sc.next().split(",");
			int L = Integer.parseInt(strs[0]) - 1;
			int R = Integer.parseInt(strs[1]) - 1;
			int temp = ints[L];
			ints[L] = ints[R];
			ints[R] = temp;
		} {
			strs = sc.next().split(",");
			int L = Integer.parseInt(strs[0]) - 1;
			int R = Integer.parseInt(strs[1]) - 1;
			int temp = ints[L];
			ints[L] = ints[R];
			ints[R] = temp;
		} strs = sc.next().split(",") strs sc.next().split(",") sc.next().split sc.next() sc.next sc "," int L = Integer.parseInt(strs[0]) - 1; L Integer.parseInt(strs[0]) - 1 Integer.parseInt(strs[0]) Integer.parseInt Integer strs[0] strs 0 1 int R = Integer.parseInt(strs[1]) - 1; R Integer.parseInt(strs[1]) - 1 Integer.parseInt(strs[1]) Integer.parseInt Integer strs[1] strs 1 1 int temp = ints[L]; temp ints[L] ints L ints[L] = ints[R] ints[L] ints L ints[R] ints R ints[R] = temp ints[R] ints R temp for (int i=0; i<w; i++) {
			System.out.println(ints[i]);
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			System.out.println(ints[i]);
		} {
			System.out.println(ints[i]);
		} System.out.println(ints[i]) System.out.println System.out System System.out ints[i] ints i String[] args args public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int w = sc.nextInt();
		int[] ints = new int[w];
		for (int i=0; i<w; i++) {
			ints[i] = i+1;
		}
		int n = sc.nextInt();
		String[] strs = new String[2];
		for (int i=0; i<n; i++) {
			strs = sc.next().split(",");
			int L = Integer.parseInt(strs[0]) - 1;
			int R = Integer.parseInt(strs[1]) - 1;
			int temp = ints[L];
			ints[L] = ints[R];
			ints[R] = temp;
		}
		for (int i=0; i<w; i++) {
			System.out.println(ints[i]);
		}
	}
} public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int w = sc.nextInt();
		int[] ints = new int[w];
		for (int i=0; i<w; i++) {
			ints[i] = i+1;
		}
		int n = sc.nextInt();
		String[] strs = new String[2];
		for (int i=0; i<n; i++) {
			strs = sc.next().split(",");
			int L = Integer.parseInt(strs[0]) - 1;
			int R = Integer.parseInt(strs[1]) - 1;
			int temp = ints[L];
			ints[L] = ints[R];
			ints[R] = temp;
		}
		for (int i=0; i<w; i++) {
			System.out.println(ints[i]);
		}
	}
} Main
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int w = sc.nextInt();
		int[] ints = new int[w];
		for (int i=0; i<w; i++) {
			ints[i] = i+1;
		}
		int n = sc.nextInt();
		String[] strs = new String[2];
		for (int i=0; i<n; i++) {
			strs = sc.next().split(",");
			int L = Integer.parseInt(strs[0]) - 1;
			int R = Integer.parseInt(strs[1]) - 1;
			int temp = ints[L];
			ints[L] = ints[R];
			ints[R] = temp;
		}
		for (int i=0; i<w; i++) {
			System.out.println(ints[i]);
		}
	}
}
