import java.io.*;

class Main {
	public static void main(String args[]) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String t[];
			int w = Integer.parseInt(reader.readLine());
			int n = Integer.parseInt(reader.readLine());
			int a[] = new int[w];
			for(int i = 0;i < w;i++) {
				a[i] = i+1;
			}
			for(int i = 0;i < n;i++) {
				t = reader.readLine().split(",");
				swap(a, Integer.parseInt(t[0])-1, Integer.parseInt(t[1])-1);
			}
			for(int i = 0;i < w;i++) {
				System.out.println(a[i]);
			}
		}
		catch(IOException e) {
			System.out.println(e);
		}
	}
	public static void swap(int a[], int i, int j) {
		int tmp = a[i];
		a[i] = a[j];
		a[j] = tmp;
	}
} import java.io.*; io.* java class Main {
	public static void main(String args[]) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String t[];
			int w = Integer.parseInt(reader.readLine());
			int n = Integer.parseInt(reader.readLine());
			int a[] = new int[w];
			for(int i = 0;i < w;i++) {
				a[i] = i+1;
			}
			for(int i = 0;i < n;i++) {
				t = reader.readLine().split(",");
				swap(a, Integer.parseInt(t[0])-1, Integer.parseInt(t[1])-1);
			}
			for(int i = 0;i < w;i++) {
				System.out.println(a[i]);
			}
		}
		catch(IOException e) {
			System.out.println(e);
		}
	}
	public static void swap(int a[], int i, int j) {
		int tmp = a[i];
		a[i] = a[j];
		a[j] = tmp;
	}
} Main public static void main(String args[]) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String t[];
			int w = Integer.parseInt(reader.readLine());
			int n = Integer.parseInt(reader.readLine());
			int a[] = new int[w];
			for(int i = 0;i < w;i++) {
				a[i] = i+1;
			}
			for(int i = 0;i < n;i++) {
				t = reader.readLine().split(",");
				swap(a, Integer.parseInt(t[0])-1, Integer.parseInt(t[1])-1);
			}
			for(int i = 0;i < w;i++) {
				System.out.println(a[i]);
			}
		}
		catch(IOException e) {
			System.out.println(e);
		}
	} main {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String t[];
			int w = Integer.parseInt(reader.readLine());
			int n = Integer.parseInt(reader.readLine());
			int a[] = new int[w];
			for(int i = 0;i < w;i++) {
				a[i] = i+1;
			}
			for(int i = 0;i < n;i++) {
				t = reader.readLine().split(",");
				swap(a, Integer.parseInt(t[0])-1, Integer.parseInt(t[1])-1);
			}
			for(int i = 0;i < w;i++) {
				System.out.println(a[i]);
			}
		}
		catch(IOException e) {
			System.out.println(e);
		}
	} try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String t[];
			int w = Integer.parseInt(reader.readLine());
			int n = Integer.parseInt(reader.readLine());
			int a[] = new int[w];
			for(int i = 0;i < w;i++) {
				a[i] = i+1;
			}
			for(int i = 0;i < n;i++) {
				t = reader.readLine().split(",");
				swap(a, Integer.parseInt(t[0])-1, Integer.parseInt(t[1])-1);
			}
			for(int i = 0;i < w;i++) {
				System.out.println(a[i]);
			}
		}
		catch(IOException e) {
			System.out.println(e);
		} catch(IOException e) {
			System.out.println(e);
		} IOException e {
			System.out.println(e);
		} System.out.println(e) System.out.println System.out System System.out e {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String t[];
			int w = Integer.parseInt(reader.readLine());
			int n = Integer.parseInt(reader.readLine());
			int a[] = new int[w];
			for(int i = 0;i < w;i++) {
				a[i] = i+1;
			}
			for(int i = 0;i < n;i++) {
				t = reader.readLine().split(",");
				swap(a, Integer.parseInt(t[0])-1, Integer.parseInt(t[1])-1);
			}
			for(int i = 0;i < w;i++) {
				System.out.println(a[i]);
			}
		} BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String t[]; t int w = Integer.parseInt(reader.readLine()); w Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int n = Integer.parseInt(reader.readLine()); n Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int a[] = new int[w]; a new int[w] w for(int i = 0;i < w;i++) {
				a[i] = i+1;
			} int i = 0; int i = 0; i 0 i < w i w 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 < n;i++) {
				t = reader.readLine().split(",");
				swap(a, Integer.parseInt(t[0])-1, Integer.parseInt(t[1])-1);
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				t = reader.readLine().split(",");
				swap(a, Integer.parseInt(t[0])-1, Integer.parseInt(t[1])-1);
			} {
				t = reader.readLine().split(",");
				swap(a, Integer.parseInt(t[0])-1, Integer.parseInt(t[1])-1);
			} t = reader.readLine().split(",") t reader.readLine().split(",") reader.readLine().split reader.readLine() reader.readLine reader "," swap(a, Integer.parseInt(t[0])-1, Integer.parseInt(t[1])-1) swap a Integer.parseInt(t[0])-1 Integer.parseInt(t[0]) Integer.parseInt Integer t[0] t 0 1 Integer.parseInt(t[1])-1 Integer.parseInt(t[1]) Integer.parseInt Integer t[1] t 1 1 for(int i = 0;i < w;i++) {
				System.out.println(a[i]);
			} int i = 0; int i = 0; i 0 i < w i w 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 static void swap(int a[], int i, int j) {
		int tmp = a[i];
		a[i] = a[j];
		a[j] = tmp;
	} swap {
		int tmp = a[i];
		a[i] = a[j];
		a[j] = tmp;
	} int tmp = a[i]; tmp a[i] a i a[i] = a[j] a[i] a i a[j] a j a[j] = tmp a[j] a j tmp int a[] a int i i int j j
import java.io.*;

class Main {
	public static void main(String args[]) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String t[];
			int w = Integer.parseInt(reader.readLine());
			int n = Integer.parseInt(reader.readLine());
			int a[] = new int[w];
			for(int i = 0;i < w;i++) {
				a[i] = i+1;
			}
			for(int i = 0;i < n;i++) {
				t = reader.readLine().split(",");
				swap(a, Integer.parseInt(t[0])-1, Integer.parseInt(t[1])-1);
			}
			for(int i = 0;i < w;i++) {
				System.out.println(a[i]);
			}
		}
		catch(IOException e) {
			System.out.println(e);
		}
	}
	public static void swap(int a[], int i, int j) {
		int tmp = a[i];
		a[i] = a[j];
		a[j] = tmp;
	}
}