import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in).useDelimiter("\\D");
		int w = s.nextInt();
		int n = s.nextInt();
		int[] l = new int[w];
		for(int i = 0; i < w; ++i) {
			l[i] = i + 1;
		}
		for(int i = 0; i < n; ++i) {
			int a = s.nextInt();
			int b = s.nextInt();
			int t = l[a - 1];
			l[a - 1] = l[b - 1];
			l[b - 1] = t;
		}
		for(int i : l) {
			System.out.println(i);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in).useDelimiter("\\D");
		int w = s.nextInt();
		int n = s.nextInt();
		int[] l = new int[w];
		for(int i = 0; i < w; ++i) {
			l[i] = i + 1;
		}
		for(int i = 0; i < n; ++i) {
			int a = s.nextInt();
			int b = s.nextInt();
			int t = l[a - 1];
			l[a - 1] = l[b - 1];
			l[b - 1] = t;
		}
		for(int i : l) {
			System.out.println(i);
		}
	}
} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in).useDelimiter("\\D");
		int w = s.nextInt();
		int n = s.nextInt();
		int[] l = new int[w];
		for(int i = 0; i < w; ++i) {
			l[i] = i + 1;
		}
		for(int i = 0; i < n; ++i) {
			int a = s.nextInt();
			int b = s.nextInt();
			int t = l[a - 1];
			l[a - 1] = l[b - 1];
			l[b - 1] = t;
		}
		for(int i : l) {
			System.out.println(i);
		}
	} main {
		Scanner s = new Scanner(System.in).useDelimiter("\\D");
		int w = s.nextInt();
		int n = s.nextInt();
		int[] l = new int[w];
		for(int i = 0; i < w; ++i) {
			l[i] = i + 1;
		}
		for(int i = 0; i < n; ++i) {
			int a = s.nextInt();
			int b = s.nextInt();
			int t = l[a - 1];
			l[a - 1] = l[b - 1];
			l[b - 1] = t;
		}
		for(int i : l) {
			System.out.println(i);
		}
	} Scanner s = new Scanner(System.in).useDelimiter("\\D"); s new Scanner(System.in).useDelimiter("\\D") new Scanner(System.in).useDelimiter new Scanner(System.in) "\\D" int w = s.nextInt(); w s.nextInt() s.nextInt s int n = s.nextInt(); n s.nextInt() s.nextInt s int[] l = new int[w]; l new int[w] w for(int i = 0; i < w; ++i) {
			l[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < w i w ++i ++i i {
			l[i] = i + 1;
		} {
			l[i] = i + 1;
		} l[i] = i + 1 l[i] l i i + 1 i 1 for(int i = 0; i < n; ++i) {
			int a = s.nextInt();
			int b = s.nextInt();
			int t = l[a - 1];
			l[a - 1] = l[b - 1];
			l[b - 1] = t;
		} int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
			int a = s.nextInt();
			int b = s.nextInt();
			int t = l[a - 1];
			l[a - 1] = l[b - 1];
			l[b - 1] = t;
		} {
			int a = s.nextInt();
			int b = s.nextInt();
			int t = l[a - 1];
			l[a - 1] = l[b - 1];
			l[b - 1] = t;
		} int a = s.nextInt(); a s.nextInt() s.nextInt s int b = s.nextInt(); b s.nextInt() s.nextInt s int t = l[a - 1]; t l[a - 1] l a - 1 a 1 l[a - 1] = l[b - 1] l[a - 1] l a - 1 a 1 l[b - 1] l b - 1 b 1 l[b - 1] = t l[b - 1] l b - 1 b 1 t for(int i : l) {
			System.out.println(i);
		} int i l {
			System.out.println(i);
		} {
			System.out.println(i);
		} System.out.println(i) System.out.println System.out System System.out i String[] args args public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in).useDelimiter("\\D");
		int w = s.nextInt();
		int n = s.nextInt();
		int[] l = new int[w];
		for(int i = 0; i < w; ++i) {
			l[i] = i + 1;
		}
		for(int i = 0; i < n; ++i) {
			int a = s.nextInt();
			int b = s.nextInt();
			int t = l[a - 1];
			l[a - 1] = l[b - 1];
			l[b - 1] = t;
		}
		for(int i : l) {
			System.out.println(i);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in).useDelimiter("\\D");
		int w = s.nextInt();
		int n = s.nextInt();
		int[] l = new int[w];
		for(int i = 0; i < w; ++i) {
			l[i] = i + 1;
		}
		for(int i = 0; i < n; ++i) {
			int a = s.nextInt();
			int b = s.nextInt();
			int t = l[a - 1];
			l[a - 1] = l[b - 1];
			l[b - 1] = t;
		}
		for(int i : l) {
			System.out.println(i);
		}
	}
} Main
import java.util.Scanner;

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