import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n, k;
		int a[];

		n = sc.nextInt();
		k = sc.nextInt();
		a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = i + 1;
		}
		for (int i = 0; i < k; i++) {
			String st = sc.next();
			int left = 0, right = 0;
			for (int j = 0; ; j++) {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			}
			int swap = a[left - 1];
			a[left - 1] = a[right - 1];
			a[right - 1] = swap;
		}
		for (int i = 0; i < n; i++) {
			System.out.println(a[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n, k;
		int a[];

		n = sc.nextInt();
		k = sc.nextInt();
		a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = i + 1;
		}
		for (int i = 0; i < k; i++) {
			String st = sc.next();
			int left = 0, right = 0;
			for (int j = 0; ; j++) {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			}
			int swap = a[left - 1];
			a[left - 1] = a[right - 1];
			a[right - 1] = swap;
		}
		for (int i = 0; i < n; i++) {
			System.out.println(a[i]);
		}
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n, k;
		int a[];

		n = sc.nextInt();
		k = sc.nextInt();
		a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = i + 1;
		}
		for (int i = 0; i < k; i++) {
			String st = sc.next();
			int left = 0, right = 0;
			for (int j = 0; ; j++) {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			}
			int swap = a[left - 1];
			a[left - 1] = a[right - 1];
			a[right - 1] = swap;
		}
		for (int i = 0; i < n; i++) {
			System.out.println(a[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int n, k;
		int a[];

		n = sc.nextInt();
		k = sc.nextInt();
		a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = i + 1;
		}
		for (int i = 0; i < k; i++) {
			String st = sc.next();
			int left = 0, right = 0;
			for (int j = 0; ; j++) {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			}
			int swap = a[left - 1];
			a[left - 1] = a[right - 1];
			a[right - 1] = swap;
		}
		for (int i = 0; i < n; i++) {
			System.out.println(a[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n n k; k int a[]; a n = sc.nextInt() n sc.nextInt() sc.nextInt sc k = sc.nextInt() k sc.nextInt() sc.nextInt sc a = new int[n] a new int[n] n for (int i = 0; i < n; i++) {
			a[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = i + 1;
		} {
			a[i] = i + 1;
		} a[i] = i + 1 a[i] a i i + 1 i 1 for (int i = 0; i < k; i++) {
			String st = sc.next();
			int left = 0, right = 0;
			for (int j = 0; ; j++) {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			}
			int swap = a[left - 1];
			a[left - 1] = a[right - 1];
			a[right - 1] = swap;
		} int i = 0; int i = 0; i 0 i < k i k i++ i++ i {
			String st = sc.next();
			int left = 0, right = 0;
			for (int j = 0; ; j++) {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			}
			int swap = a[left - 1];
			a[left - 1] = a[right - 1];
			a[right - 1] = swap;
		} {
			String st = sc.next();
			int left = 0, right = 0;
			for (int j = 0; ; j++) {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			}
			int swap = a[left - 1];
			a[left - 1] = a[right - 1];
			a[right - 1] = swap;
		} String st = sc.next(); st sc.next() sc.next sc int left = 0 left 0 right = 0; right 0 for (int j = 0; ; j++) {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			} int j = 0; int j = 0; j 0 j++ j++ j {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			} {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			} left *= 10 left 10 left += st.charAt(j) - '0' left st.charAt(j) - '0' st.charAt(j) st.charAt st j '0' if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				} st.charAt(j + 1) == ',' st.charAt(j + 1) st.charAt st j + 1 j 1 ',' {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				} for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					} int l = j + 2; int l = j + 2; l j + 2 j 2 l < st.length() l st.length() st.length st l++ l++ l {
						right *= 10;
						right += st.charAt(l) - '0';
					} {
						right *= 10;
						right += st.charAt(l) - '0';
					} right *= 10 right 10 right += st.charAt(l) - '0' right st.charAt(l) - '0' st.charAt(l) st.charAt st l '0' break; int swap = a[left - 1]; swap a[left - 1] a left - 1 left 1 a[left - 1] = a[right - 1] a[left - 1] a left - 1 left 1 a[right - 1] a right - 1 right 1 a[right - 1] = swap a[right - 1] a right - 1 right 1 swap for (int i = 0; i < n; i++) {
			System.out.println(a[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.println(a[i]);
		} {
			System.out.println(a[i]);
		} System.out.println(a[i]) System.out.println System.out System System.out a[i] a i String args[] args public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n, k;
		int a[];

		n = sc.nextInt();
		k = sc.nextInt();
		a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = i + 1;
		}
		for (int i = 0; i < k; i++) {
			String st = sc.next();
			int left = 0, right = 0;
			for (int j = 0; ; j++) {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			}
			int swap = a[left - 1];
			a[left - 1] = a[right - 1];
			a[right - 1] = swap;
		}
		for (int i = 0; i < n; i++) {
			System.out.println(a[i]);
		}
	}
} public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n, k;
		int a[];

		n = sc.nextInt();
		k = sc.nextInt();
		a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = i + 1;
		}
		for (int i = 0; i < k; i++) {
			String st = sc.next();
			int left = 0, right = 0;
			for (int j = 0; ; j++) {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			}
			int swap = a[left - 1];
			a[left - 1] = a[right - 1];
			a[right - 1] = swap;
		}
		for (int i = 0; i < n; i++) {
			System.out.println(a[i]);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n, k;
		int a[];

		n = sc.nextInt();
		k = sc.nextInt();
		a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = i + 1;
		}
		for (int i = 0; i < k; i++) {
			String st = sc.next();
			int left = 0, right = 0;
			for (int j = 0; ; j++) {
				left *= 10;
				left += st.charAt(j) - '0';
				if (st.charAt(j + 1) == ',') {
					for (int l = j + 2; l < st.length(); l++) {
						right *= 10;
						right += st.charAt(l) - '0';
					}
					break;
				}
			}
			int swap = a[left - 1];
			a[left - 1] = a[right - 1];
			a[right - 1] = swap;
		}
		for (int i = 0; i < n; i++) {
			System.out.println(a[i]);
		}
	}
}