import java.util.Scanner;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int ans[] = new int[w];
		for (int i=0;i<w;i++) {
			ans[i] = i+1;
		}
		for (int i=0;i<n;i++) {
			String line = sc.next();
			int a = line.indexOf(',');
			int x1 = Integer.parseInt(line.substring(0,a))-1;
			int x2 = Integer.parseInt(line.substring(a+1,line.length()))-1;
			int temp = ans[x1];
			ans[x1] = ans[x2];
			ans[x2] = temp;
		}
		for (int i=0;i<w;i++) {
			System.out.println(ans[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int ans[] = new int[w];
		for (int i=0;i<w;i++) {
			ans[i] = i+1;
		}
		for (int i=0;i<n;i++) {
			String line = sc.next();
			int a = line.indexOf(',');
			int x1 = Integer.parseInt(line.substring(0,a))-1;
			int x2 = Integer.parseInt(line.substring(a+1,line.length()))-1;
			int temp = ans[x1];
			ans[x1] = ans[x2];
			ans[x2] = temp;
		}
		for (int i=0;i<w;i++) {
			System.out.println(ans[i]);
		}
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int ans[] = new int[w];
		for (int i=0;i<w;i++) {
			ans[i] = i+1;
		}
		for (int i=0;i<n;i++) {
			String line = sc.next();
			int a = line.indexOf(',');
			int x1 = Integer.parseInt(line.substring(0,a))-1;
			int x2 = Integer.parseInt(line.substring(a+1,line.length()))-1;
			int temp = ans[x1];
			ans[x1] = ans[x2];
			ans[x2] = temp;
		}
		for (int i=0;i<w;i++) {
			System.out.println(ans[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int ans[] = new int[w];
		for (int i=0;i<w;i++) {
			ans[i] = i+1;
		}
		for (int i=0;i<n;i++) {
			String line = sc.next();
			int a = line.indexOf(',');
			int x1 = Integer.parseInt(line.substring(0,a))-1;
			int x2 = Integer.parseInt(line.substring(a+1,line.length()))-1;
			int temp = ans[x1];
			ans[x1] = ans[x2];
			ans[x2] = temp;
		}
		for (int i=0;i<w;i++) {
			System.out.println(ans[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans[] = new int[w]; ans new int[w] w for (int i=0;i<w;i++) {
			ans[i] = i+1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			ans[i] = i+1;
		} {
			ans[i] = i+1;
		} ans[i] = i+1 ans[i] ans i i+1 i 1 for (int i=0;i<n;i++) {
			String line = sc.next();
			int a = line.indexOf(',');
			int x1 = Integer.parseInt(line.substring(0,a))-1;
			int x2 = Integer.parseInt(line.substring(a+1,line.length()))-1;
			int temp = ans[x1];
			ans[x1] = ans[x2];
			ans[x2] = temp;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String line = sc.next();
			int a = line.indexOf(',');
			int x1 = Integer.parseInt(line.substring(0,a))-1;
			int x2 = Integer.parseInt(line.substring(a+1,line.length()))-1;
			int temp = ans[x1];
			ans[x1] = ans[x2];
			ans[x2] = temp;
		} {
			String line = sc.next();
			int a = line.indexOf(',');
			int x1 = Integer.parseInt(line.substring(0,a))-1;
			int x2 = Integer.parseInt(line.substring(a+1,line.length()))-1;
			int temp = ans[x1];
			ans[x1] = ans[x2];
			ans[x2] = temp;
		} String line = sc.next(); line sc.next() sc.next sc int a = line.indexOf(','); a line.indexOf(',') line.indexOf line ',' int x1 = Integer.parseInt(line.substring(0,a))-1; x1 Integer.parseInt(line.substring(0,a))-1 Integer.parseInt(line.substring(0,a)) Integer.parseInt Integer line.substring(0,a) line.substring line 0 a 1 int x2 = Integer.parseInt(line.substring(a+1,line.length()))-1; x2 Integer.parseInt(line.substring(a+1,line.length()))-1 Integer.parseInt(line.substring(a+1,line.length())) Integer.parseInt Integer line.substring(a+1,line.length()) line.substring line a+1 a 1 line.length() line.length line 1 int temp = ans[x1]; temp ans[x1] ans x1 ans[x1] = ans[x2] ans[x1] ans x1 ans[x2] ans x2 ans[x2] = temp ans[x2] ans x2 temp for (int i=0;i<w;i++) {
			System.out.println(ans[i]);
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			System.out.println(ans[i]);
		} {
			System.out.println(ans[i]);
		} System.out.println(ans[i]) System.out.println System.out System System.out ans[i] ans i String args[] args public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int ans[] = new int[w];
		for (int i=0;i<w;i++) {
			ans[i] = i+1;
		}
		for (int i=0;i<n;i++) {
			String line = sc.next();
			int a = line.indexOf(',');
			int x1 = Integer.parseInt(line.substring(0,a))-1;
			int x2 = Integer.parseInt(line.substring(a+1,line.length()))-1;
			int temp = ans[x1];
			ans[x1] = ans[x2];
			ans[x2] = temp;
		}
		for (int i=0;i<w;i++) {
			System.out.println(ans[i]);
		}
	}
} public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int ans[] = new int[w];
		for (int i=0;i<w;i++) {
			ans[i] = i+1;
		}
		for (int i=0;i<n;i++) {
			String line = sc.next();
			int a = line.indexOf(',');
			int x1 = Integer.parseInt(line.substring(0,a))-1;
			int x2 = Integer.parseInt(line.substring(a+1,line.length()))-1;
			int temp = ans[x1];
			ans[x1] = ans[x2];
			ans[x2] = temp;
		}
		for (int i=0;i<w;i++) {
			System.out.println(ans[i]);
		}
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int ans[] = new int[w];
		for (int i=0;i<w;i++) {
			ans[i] = i+1;
		}
		for (int i=0;i<n;i++) {
			String line = sc.next();
			int a = line.indexOf(',');
			int x1 = Integer.parseInt(line.substring(0,a))-1;
			int x2 = Integer.parseInt(line.substring(a+1,line.length()))-1;
			int temp = ans[x1];
			ans[x1] = ans[x2];
			ans[x2] = temp;
		}
		for (int i=0;i<w;i++) {
			System.out.println(ans[i]);
		}
	}
}