import java.util.*;


class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		Main main = new Main();
		int w = scan.nextInt();
		int n = scan.nextInt();
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i = 0; i < w; i++) {
			list.add(i + 1);
		}
		
		int a, b, index = 0;
		
		for(int i = 0; i < n; i++) {
			
			String[] str = scan.next().split(",");
			a = Integer.valueOf(str[0]);
			b = Integer.valueOf(str[1]);
			
			for(int j = 0; j < w; j++) {
				if( a-1 == j) {
					index = j;
					continue;
				}
				if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				}
			}
			
		}
		
		for(int i : list) {
			System.out.println(i);
		}
	}
} import java.util.*; util.* java class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		Main main = new Main();
		int w = scan.nextInt();
		int n = scan.nextInt();
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i = 0; i < w; i++) {
			list.add(i + 1);
		}
		
		int a, b, index = 0;
		
		for(int i = 0; i < n; i++) {
			
			String[] str = scan.next().split(",");
			a = Integer.valueOf(str[0]);
			b = Integer.valueOf(str[1]);
			
			for(int j = 0; j < w; j++) {
				if( a-1 == j) {
					index = j;
					continue;
				}
				if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				}
			}
			
		}
		
		for(int i : list) {
			System.out.println(i);
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		Main main = new Main();
		int w = scan.nextInt();
		int n = scan.nextInt();
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i = 0; i < w; i++) {
			list.add(i + 1);
		}
		
		int a, b, index = 0;
		
		for(int i = 0; i < n; i++) {
			
			String[] str = scan.next().split(",");
			a = Integer.valueOf(str[0]);
			b = Integer.valueOf(str[1]);
			
			for(int j = 0; j < w; j++) {
				if( a-1 == j) {
					index = j;
					continue;
				}
				if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				}
			}
			
		}
		
		for(int i : list) {
			System.out.println(i);
		}
	} main {
		Scanner scan = new Scanner(System.in);
		
		Main main = new Main();
		int w = scan.nextInt();
		int n = scan.nextInt();
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i = 0; i < w; i++) {
			list.add(i + 1);
		}
		
		int a, b, index = 0;
		
		for(int i = 0; i < n; i++) {
			
			String[] str = scan.next().split(",");
			a = Integer.valueOf(str[0]);
			b = Integer.valueOf(str[1]);
			
			for(int j = 0; j < w; j++) {
				if( a-1 == j) {
					index = j;
					continue;
				}
				if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				}
			}
			
		}
		
		for(int i : list) {
			System.out.println(i);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) Main main = new Main(); main new Main() int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for(int i = 0; i < w; i++) {
			list.add(i + 1);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			list.add(i + 1);
		} {
			list.add(i + 1);
		} list.add(i + 1) list.add list i + 1 i 1 int a a b b index = 0; index 0 for(int i = 0; i < n; i++) {
			
			String[] str = scan.next().split(",");
			a = Integer.valueOf(str[0]);
			b = Integer.valueOf(str[1]);
			
			for(int j = 0; j < w; j++) {
				if( a-1 == j) {
					index = j;
					continue;
				}
				if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				}
			}
			
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			
			String[] str = scan.next().split(",");
			a = Integer.valueOf(str[0]);
			b = Integer.valueOf(str[1]);
			
			for(int j = 0; j < w; j++) {
				if( a-1 == j) {
					index = j;
					continue;
				}
				if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				}
			}
			
		} {
			
			String[] str = scan.next().split(",");
			a = Integer.valueOf(str[0]);
			b = Integer.valueOf(str[1]);
			
			for(int j = 0; j < w; j++) {
				if( a-1 == j) {
					index = j;
					continue;
				}
				if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				}
			}
			
		} String[] str = scan.next().split(","); str scan.next().split(",") scan.next().split scan.next() scan.next scan "," a = Integer.valueOf(str[0]) a Integer.valueOf(str[0]) Integer.valueOf Integer str[0] str 0 b = Integer.valueOf(str[1]) b Integer.valueOf(str[1]) Integer.valueOf Integer str[1] str 1 for(int j = 0; j < w; j++) {
				if( a-1 == j) {
					index = j;
					continue;
				}
				if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				}
			} int j = 0; int j = 0; j 0 j < w j w j++ j++ j {
				if( a-1 == j) {
					index = j;
					continue;
				}
				if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				}
			} {
				if( a-1 == j) {
					index = j;
					continue;
				}
				if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				}
			} if( a-1 == j) {
					index = j;
					continue;
				} a-1 == j a-1 a 1 j {
					index = j;
					continue;
				} index = j index j continue; if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				} b-1 == j b-1 b 1 j {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				} int temp = list.get(index); temp list.get(index) list.get list index list.set(index, list.get(j)) list.set list index list.get(j) list.get list j list.set(j, temp) list.set list j temp for(int i : list) {
			System.out.println(i);
		} int i list {
			System.out.println(i);
		} {
			System.out.println(i);
		} System.out.println(i) System.out.println System.out System System.out i String[] args args
import java.util.*;


class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		Main main = new Main();
		int w = scan.nextInt();
		int n = scan.nextInt();
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i = 0; i < w; i++) {
			list.add(i + 1);
		}
		
		int a, b, index = 0;
		
		for(int i = 0; i < n; i++) {
			
			String[] str = scan.next().split(",");
			a = Integer.valueOf(str[0]);
			b = Integer.valueOf(str[1]);
			
			for(int j = 0; j < w; j++) {
				if( a-1 == j) {
					index = j;
					continue;
				}
				if( b-1 == j) {
					int temp = list.get(index);
					list.set(index, list.get(j));
					list.set(j, temp);
				}
			}
			
		}
		
		for(int i : list) {
			System.out.println(i);
		}
	}
}