import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[][] c = new int[k][];
		
		for(int i = 0; i < k; i++) {
			String s = sc.next();
			String[] ns = s.split(",");
			c[i] = new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1};
		}
		int[] res = new int[n];
		for(int i = 0; i < n; i++) {
			int ret = i;
			for(int j = 0; j < k; j++) {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			}
			res[ret] = i;
		}
		for(int i = 0; i < n; i++) {
			System.out.println(res[i] + 1);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[][] c = new int[k][];
		
		for(int i = 0; i < k; i++) {
			String s = sc.next();
			String[] ns = s.split(",");
			c[i] = new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1};
		}
		int[] res = new int[n];
		for(int i = 0; i < n; i++) {
			int ret = i;
			for(int j = 0; j < k; j++) {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			}
			res[ret] = i;
		}
		for(int i = 0; i < n; i++) {
			System.out.println(res[i] + 1);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[][] c = new int[k][];
		
		for(int i = 0; i < k; i++) {
			String s = sc.next();
			String[] ns = s.split(",");
			c[i] = new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1};
		}
		int[] res = new int[n];
		for(int i = 0; i < n; i++) {
			int ret = i;
			for(int j = 0; j < k; j++) {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			}
			res[ret] = i;
		}
		for(int i = 0; i < n; i++) {
			System.out.println(res[i] + 1);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[][] c = new int[k][];
		
		for(int i = 0; i < k; i++) {
			String s = sc.next();
			String[] ns = s.split(",");
			c[i] = new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1};
		}
		int[] res = new int[n];
		for(int i = 0; i < n; i++) {
			int ret = i;
			for(int j = 0; j < k; j++) {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			}
			res[ret] = i;
		}
		for(int i = 0; i < n; i++) {
			System.out.println(res[i] + 1);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int k = sc.nextInt(); k sc.nextInt() sc.nextInt sc int[][] c = new int[k][]; c new int[k][] k for(int i = 0; i < k; i++) {
			String s = sc.next();
			String[] ns = s.split(",");
			c[i] = new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1};
		} int i = 0; int i = 0; i 0 i < k i k i++ i++ i {
			String s = sc.next();
			String[] ns = s.split(",");
			c[i] = new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1};
		} {
			String s = sc.next();
			String[] ns = s.split(",");
			c[i] = new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1};
		} String s = sc.next(); s sc.next() sc.next sc String[] ns = s.split(","); ns s.split(",") s.split s "," c[i] = new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1} c[i] c i new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1} int[] res = new int[n]; res new int[n] n for(int i = 0; i < n; i++) {
			int ret = i;
			for(int j = 0; j < k; j++) {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			}
			res[ret] = i;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int ret = i;
			for(int j = 0; j < k; j++) {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			}
			res[ret] = i;
		} {
			int ret = i;
			for(int j = 0; j < k; j++) {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			}
			res[ret] = i;
		} int ret = i; ret i for(int j = 0; j < k; j++) {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			} int j = 0; int j = 0; j 0 j < k j k j++ j++ j {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			} {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			} for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				} int l = 0; int l = 0; l 0 l < 2 l 2 l++ l++ l {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				} {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				} if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					} c[j][l] == ret c[j][l] c[j] c j l ret {
						ret = c[j][(l + 1) % 2];
						break;
					} ret = c[j][(l + 1) % 2] ret c[j][(l + 1) % 2] c[j] c j (l + 1) % 2 (l + 1) l 1 2 break; res[ret] = i res[ret] res ret i for(int i = 0; i < n; i++) {
			System.out.println(res[i] + 1);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.println(res[i] + 1);
		} {
			System.out.println(res[i] + 1);
		} System.out.println(res[i] + 1) System.out.println System.out System System.out res[i] + 1 res[i] res i 1 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[][] c = new int[k][];
		
		for(int i = 0; i < k; i++) {
			String s = sc.next();
			String[] ns = s.split(",");
			c[i] = new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1};
		}
		int[] res = new int[n];
		for(int i = 0; i < n; i++) {
			int ret = i;
			for(int j = 0; j < k; j++) {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			}
			res[ret] = i;
		}
		for(int i = 0; i < n; i++) {
			System.out.println(res[i] + 1);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[][] c = new int[k][];
		
		for(int i = 0; i < k; i++) {
			String s = sc.next();
			String[] ns = s.split(",");
			c[i] = new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1};
		}
		int[] res = new int[n];
		for(int i = 0; i < n; i++) {
			int ret = i;
			for(int j = 0; j < k; j++) {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			}
			res[ret] = i;
		}
		for(int i = 0; i < n; i++) {
			System.out.println(res[i] + 1);
		}
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[][] c = new int[k][];
		
		for(int i = 0; i < k; i++) {
			String s = sc.next();
			String[] ns = s.split(",");
			c[i] = new int[]{Integer.parseInt(ns[0]) - 1, Integer.parseInt(ns[1]) - 1};
		}
		int[] res = new int[n];
		for(int i = 0; i < n; i++) {
			int ret = i;
			for(int j = 0; j < k; j++) {
				for(int l = 0; l < 2; l++) {
					if(c[j][l] == ret) {
						ret = c[j][(l + 1) % 2];
						break;
					}
				}
			}
			res[ret] = i;
		}
		for(int i = 0; i < n; i++) {
			System.out.println(res[i] + 1);
		}
	}
}