import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		int end[] = new int [w + 1];
		int change[][] = new int [n][2];
		for(int i = 0;i < n;i++){
			String[] num = in.next().split(",");
			change[i][0] = Integer.valueOf(num[0]);
			change[i][1] = Integer.valueOf(num[1]);
		}
		for(int i = 1;i <= w;i++){
			int ans = i;
			for(int j = 0;j < n;j++){
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			}
			end[ans] = i;
		}
		for(int i = 1;i <= w;i++){
			System.out.println(end[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		int end[] = new int [w + 1];
		int change[][] = new int [n][2];
		for(int i = 0;i < n;i++){
			String[] num = in.next().split(",");
			change[i][0] = Integer.valueOf(num[0]);
			change[i][1] = Integer.valueOf(num[1]);
		}
		for(int i = 1;i <= w;i++){
			int ans = i;
			for(int j = 0;j < n;j++){
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			}
			end[ans] = i;
		}
		for(int i = 1;i <= w;i++){
			System.out.println(end[i]);
		}
	}
} Main public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		int end[] = new int [w + 1];
		int change[][] = new int [n][2];
		for(int i = 0;i < n;i++){
			String[] num = in.next().split(",");
			change[i][0] = Integer.valueOf(num[0]);
			change[i][1] = Integer.valueOf(num[1]);
		}
		for(int i = 1;i <= w;i++){
			int ans = i;
			for(int j = 0;j < n;j++){
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			}
			end[ans] = i;
		}
		for(int i = 1;i <= w;i++){
			System.out.println(end[i]);
		}
	} main {
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		int end[] = new int [w + 1];
		int change[][] = new int [n][2];
		for(int i = 0;i < n;i++){
			String[] num = in.next().split(",");
			change[i][0] = Integer.valueOf(num[0]);
			change[i][1] = Integer.valueOf(num[1]);
		}
		for(int i = 1;i <= w;i++){
			int ans = i;
			for(int j = 0;j < n;j++){
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			}
			end[ans] = i;
		}
		for(int i = 1;i <= w;i++){
			System.out.println(end[i]);
		}
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int w = in.nextInt(); w in.nextInt() in.nextInt in int n = in.nextInt(); n in.nextInt() in.nextInt in int end[] = new int [w + 1]; end new int [w + 1] w + 1 w 1 int change[][] = new int [n][2]; change new int [n][2] n 2 for(int i = 0;i < n;i++){
			String[] num = in.next().split(",");
			change[i][0] = Integer.valueOf(num[0]);
			change[i][1] = Integer.valueOf(num[1]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String[] num = in.next().split(",");
			change[i][0] = Integer.valueOf(num[0]);
			change[i][1] = Integer.valueOf(num[1]);
		} {
			String[] num = in.next().split(",");
			change[i][0] = Integer.valueOf(num[0]);
			change[i][1] = Integer.valueOf(num[1]);
		} String[] num = in.next().split(","); num in.next().split(",") in.next().split in.next() in.next in "," change[i][0] = Integer.valueOf(num[0]) change[i][0] change[i] change i 0 Integer.valueOf(num[0]) Integer.valueOf Integer num[0] num 0 change[i][1] = Integer.valueOf(num[1]) change[i][1] change[i] change i 1 Integer.valueOf(num[1]) Integer.valueOf Integer num[1] num 1 for(int i = 1;i <= w;i++){
			int ans = i;
			for(int j = 0;j < n;j++){
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			}
			end[ans] = i;
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			int ans = i;
			for(int j = 0;j < n;j++){
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			}
			end[ans] = i;
		} {
			int ans = i;
			for(int j = 0;j < n;j++){
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			}
			end[ans] = i;
		} int ans = i; ans i for(int j = 0;j < n;j++){
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			} {
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			} if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				} ans == change[j][0] ans change[j][0] change[j] change j 0 {
					ans = change[j][1];
				} ans = change[j][1] ans change[j][1] change[j] change j 1 if(ans == change[j][1]){
					ans = change[j][0];
				} ans == change[j][1] ans change[j][1] change[j] change j 1 {
					ans = change[j][0];
				} ans = change[j][0] ans change[j][0] change[j] change j 0 end[ans] = i end[ans] end ans i for(int i = 1;i <= w;i++){
			System.out.println(end[i]);
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			System.out.println(end[i]);
		} {
			System.out.println(end[i]);
		} System.out.println(end[i]) System.out.println System.out System System.out end[i] end i String args[] args public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		int end[] = new int [w + 1];
		int change[][] = new int [n][2];
		for(int i = 0;i < n;i++){
			String[] num = in.next().split(",");
			change[i][0] = Integer.valueOf(num[0]);
			change[i][1] = Integer.valueOf(num[1]);
		}
		for(int i = 1;i <= w;i++){
			int ans = i;
			for(int j = 0;j < n;j++){
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			}
			end[ans] = i;
		}
		for(int i = 1;i <= w;i++){
			System.out.println(end[i]);
		}
	}
} public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		int end[] = new int [w + 1];
		int change[][] = new int [n][2];
		for(int i = 0;i < n;i++){
			String[] num = in.next().split(",");
			change[i][0] = Integer.valueOf(num[0]);
			change[i][1] = Integer.valueOf(num[1]);
		}
		for(int i = 1;i <= w;i++){
			int ans = i;
			for(int j = 0;j < n;j++){
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			}
			end[ans] = i;
		}
		for(int i = 1;i <= w;i++){
			System.out.println(end[i]);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		int end[] = new int [w + 1];
		int change[][] = new int [n][2];
		for(int i = 0;i < n;i++){
			String[] num = in.next().split(",");
			change[i][0] = Integer.valueOf(num[0]);
			change[i][1] = Integer.valueOf(num[1]);
		}
		for(int i = 1;i <= w;i++){
			int ans = i;
			for(int j = 0;j < n;j++){
				if(ans == change[j][0]){
					ans = change[j][1];
				}else if(ans == change[j][1]){
					ans = change[j][0];
				}
			}
			end[ans] = i;
		}
		for(int i = 1;i <= w;i++){
			System.out.println(end[i]);
		}
	}
}