import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("[\\n,]");
		int l_num = scanner.nextInt();
		int w_num = scanner.nextInt();
		int[] ans = new int[l_num];
		int tmp;
		for(int i=0; i<l_num; i++){
			ans[i] = i+1;
		}
		int[] change = new int[2*w_num];
		for(int i=0; i <w_num ; i++){
			change[i*2] = scanner.nextInt();
			change[(i*2)+1] = scanner.nextInt();
		}
		for(int i=0; i<w_num ; i++){
			tmp = ans[change[i*2]-1];
			ans[change[i*2]-1] = ans[change[i*2+1]-1];
			ans[change[i*2+1]-1] = tmp;		
		}
		for(int i=0; i<l_num; i++){
			System.out.println(ans[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("[\\n,]");
		int l_num = scanner.nextInt();
		int w_num = scanner.nextInt();
		int[] ans = new int[l_num];
		int tmp;
		for(int i=0; i<l_num; i++){
			ans[i] = i+1;
		}
		int[] change = new int[2*w_num];
		for(int i=0; i <w_num ; i++){
			change[i*2] = scanner.nextInt();
			change[(i*2)+1] = scanner.nextInt();
		}
		for(int i=0; i<w_num ; i++){
			tmp = ans[change[i*2]-1];
			ans[change[i*2]-1] = ans[change[i*2+1]-1];
			ans[change[i*2+1]-1] = tmp;		
		}
		for(int i=0; i<l_num; i++){
			System.out.println(ans[i]);
		}
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("[\\n,]");
		int l_num = scanner.nextInt();
		int w_num = scanner.nextInt();
		int[] ans = new int[l_num];
		int tmp;
		for(int i=0; i<l_num; i++){
			ans[i] = i+1;
		}
		int[] change = new int[2*w_num];
		for(int i=0; i <w_num ; i++){
			change[i*2] = scanner.nextInt();
			change[(i*2)+1] = scanner.nextInt();
		}
		for(int i=0; i<w_num ; i++){
			tmp = ans[change[i*2]-1];
			ans[change[i*2]-1] = ans[change[i*2+1]-1];
			ans[change[i*2+1]-1] = tmp;		
		}
		for(int i=0; i<l_num; i++){
			System.out.println(ans[i]);
		}
	} main {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("[\\n,]");
		int l_num = scanner.nextInt();
		int w_num = scanner.nextInt();
		int[] ans = new int[l_num];
		int tmp;
		for(int i=0; i<l_num; i++){
			ans[i] = i+1;
		}
		int[] change = new int[2*w_num];
		for(int i=0; i <w_num ; i++){
			change[i*2] = scanner.nextInt();
			change[(i*2)+1] = scanner.nextInt();
		}
		for(int i=0; i<w_num ; i++){
			tmp = ans[change[i*2]-1];
			ans[change[i*2]-1] = ans[change[i*2+1]-1];
			ans[change[i*2+1]-1] = tmp;		
		}
		for(int i=0; i<l_num; i++){
			System.out.println(ans[i]);
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) scanner.useDelimiter("[\\n,]") scanner.useDelimiter scanner "[\\n,]" int l_num = scanner.nextInt(); l_num scanner.nextInt() scanner.nextInt scanner int w_num = scanner.nextInt(); w_num scanner.nextInt() scanner.nextInt scanner int[] ans = new int[l_num]; ans new int[l_num] l_num int tmp; tmp for(int i=0; i<l_num; i++){
			ans[i] = i+1;
		} int i=0; int i=0; i 0 i<l_num i l_num i++ i++ i {
			ans[i] = i+1;
		} {
			ans[i] = i+1;
		} ans[i] = i+1 ans[i] ans i i+1 i 1 int[] change = new int[2*w_num]; change new int[2*w_num] 2*w_num 2 w_num for(int i=0; i <w_num ; i++){
			change[i*2] = scanner.nextInt();
			change[(i*2)+1] = scanner.nextInt();
		} int i=0; int i=0; i 0 i <w_num i w_num i++ i++ i {
			change[i*2] = scanner.nextInt();
			change[(i*2)+1] = scanner.nextInt();
		} {
			change[i*2] = scanner.nextInt();
			change[(i*2)+1] = scanner.nextInt();
		} change[i*2] = scanner.nextInt() change[i*2] change i*2 i 2 scanner.nextInt() scanner.nextInt scanner change[(i*2)+1] = scanner.nextInt() change[(i*2)+1] change (i*2)+1 (i*2) i 2 1 scanner.nextInt() scanner.nextInt scanner for(int i=0; i<w_num ; i++){
			tmp = ans[change[i*2]-1];
			ans[change[i*2]-1] = ans[change[i*2+1]-1];
			ans[change[i*2+1]-1] = tmp;		
		} int i=0; int i=0; i 0 i<w_num i w_num i++ i++ i {
			tmp = ans[change[i*2]-1];
			ans[change[i*2]-1] = ans[change[i*2+1]-1];
			ans[change[i*2+1]-1] = tmp;		
		} {
			tmp = ans[change[i*2]-1];
			ans[change[i*2]-1] = ans[change[i*2+1]-1];
			ans[change[i*2+1]-1] = tmp;		
		} tmp = ans[change[i*2]-1] tmp ans[change[i*2]-1] ans change[i*2]-1 change[i*2] change i*2 i 2 1 ans[change[i*2]-1] = ans[change[i*2+1]-1] ans[change[i*2]-1] ans change[i*2]-1 change[i*2] change i*2 i 2 1 ans[change[i*2+1]-1] ans change[i*2+1]-1 change[i*2+1] change i*2+1 i*2 i 2 1 1 ans[change[i*2+1]-1] = tmp ans[change[i*2+1]-1] ans change[i*2+1]-1 change[i*2+1] change i*2+1 i*2 i 2 1 1 tmp for(int i=0; i<l_num; i++){
			System.out.println(ans[i]);
		} int i=0; int i=0; i 0 i<l_num i l_num 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 scanner = new Scanner(System.in);
		scanner.useDelimiter("[\\n,]");
		int l_num = scanner.nextInt();
		int w_num = scanner.nextInt();
		int[] ans = new int[l_num];
		int tmp;
		for(int i=0; i<l_num; i++){
			ans[i] = i+1;
		}
		int[] change = new int[2*w_num];
		for(int i=0; i <w_num ; i++){
			change[i*2] = scanner.nextInt();
			change[(i*2)+1] = scanner.nextInt();
		}
		for(int i=0; i<w_num ; i++){
			tmp = ans[change[i*2]-1];
			ans[change[i*2]-1] = ans[change[i*2+1]-1];
			ans[change[i*2+1]-1] = tmp;		
		}
		for(int i=0; i<l_num; i++){
			System.out.println(ans[i]);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("[\\n,]");
		int l_num = scanner.nextInt();
		int w_num = scanner.nextInt();
		int[] ans = new int[l_num];
		int tmp;
		for(int i=0; i<l_num; i++){
			ans[i] = i+1;
		}
		int[] change = new int[2*w_num];
		for(int i=0; i <w_num ; i++){
			change[i*2] = scanner.nextInt();
			change[(i*2)+1] = scanner.nextInt();
		}
		for(int i=0; i<w_num ; i++){
			tmp = ans[change[i*2]-1];
			ans[change[i*2]-1] = ans[change[i*2+1]-1];
			ans[change[i*2+1]-1] = tmp;		
		}
		for(int i=0; i<l_num; i++){
			System.out.println(ans[i]);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("[\\n,]");
		int l_num = scanner.nextInt();
		int w_num = scanner.nextInt();
		int[] ans = new int[l_num];
		int tmp;
		for(int i=0; i<l_num; i++){
			ans[i] = i+1;
		}
		int[] change = new int[2*w_num];
		for(int i=0; i <w_num ; i++){
			change[i*2] = scanner.nextInt();
			change[(i*2)+1] = scanner.nextInt();
		}
		for(int i=0; i<w_num ; i++){
			tmp = ans[change[i*2]-1];
			ans[change[i*2]-1] = ans[change[i*2+1]-1];
			ans[change[i*2+1]-1] = tmp;		
		}
		for(int i=0; i<l_num; i++){
			System.out.println(ans[i]);
		}
	}
}