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[] a = new int[w];
		for(int i = 0 ; i < a.length ; i++){
			a[i] = i+1;
		}
		
		for (int i = 0 ; i < n ; i++){
			String str = sc.next();
			String[] stra = str.split(",");
			int x = Integer.parseInt(stra[0]);
			int y = Integer.parseInt(stra[1]);
			int swap = a[x-1];
			a[x-1] = a[y-1];
			a[y-1] = swap;
		}
		for(int z : a){
			System.out.println(z);
		}
		sc.close();
	}

} 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[] a = new int[w];
		for(int i = 0 ; i < a.length ; i++){
			a[i] = i+1;
		}
		
		for (int i = 0 ; i < n ; i++){
			String str = sc.next();
			String[] stra = str.split(",");
			int x = Integer.parseInt(stra[0]);
			int y = Integer.parseInt(stra[1]);
			int swap = a[x-1];
			a[x-1] = a[y-1];
			a[y-1] = swap;
		}
		for(int z : a){
			System.out.println(z);
		}
		sc.close();
	}

} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] a = new int[w];
		for(int i = 0 ; i < a.length ; i++){
			a[i] = i+1;
		}
		
		for (int i = 0 ; i < n ; i++){
			String str = sc.next();
			String[] stra = str.split(",");
			int x = Integer.parseInt(stra[0]);
			int y = Integer.parseInt(stra[1]);
			int swap = a[x-1];
			a[x-1] = a[y-1];
			a[y-1] = swap;
		}
		for(int z : a){
			System.out.println(z);
		}
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] a = new int[w];
		for(int i = 0 ; i < a.length ; i++){
			a[i] = i+1;
		}
		
		for (int i = 0 ; i < n ; i++){
			String str = sc.next();
			String[] stra = str.split(",");
			int x = Integer.parseInt(stra[0]);
			int y = Integer.parseInt(stra[1]);
			int swap = a[x-1];
			a[x-1] = a[y-1];
			a[y-1] = swap;
		}
		for(int z : a){
			System.out.println(z);
		}
		sc.close();
	} 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[] a = new int[w]; a new int[w] w for(int i = 0 ; i < a.length ; i++){
			a[i] = i+1;
		} int i = 0 ; int i = 0 ; i 0 i < a.length i a.length a a.length i++ i++ i {
			a[i] = i+1;
		} {
			a[i] = i+1;
		} a[i] = i+1 a[i] a i i+1 i 1 for (int i = 0 ; i < n ; i++){
			String str = sc.next();
			String[] stra = str.split(",");
			int x = Integer.parseInt(stra[0]);
			int y = Integer.parseInt(stra[1]);
			int swap = a[x-1];
			a[x-1] = a[y-1];
			a[y-1] = swap;
		} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
			String str = sc.next();
			String[] stra = str.split(",");
			int x = Integer.parseInt(stra[0]);
			int y = Integer.parseInt(stra[1]);
			int swap = a[x-1];
			a[x-1] = a[y-1];
			a[y-1] = swap;
		} {
			String str = sc.next();
			String[] stra = str.split(",");
			int x = Integer.parseInt(stra[0]);
			int y = Integer.parseInt(stra[1]);
			int swap = a[x-1];
			a[x-1] = a[y-1];
			a[y-1] = swap;
		} String str = sc.next(); str sc.next() sc.next sc String[] stra = str.split(","); stra str.split(",") str.split str "," int x = Integer.parseInt(stra[0]); x Integer.parseInt(stra[0]) Integer.parseInt Integer stra[0] stra 0 int y = Integer.parseInt(stra[1]); y Integer.parseInt(stra[1]) Integer.parseInt Integer stra[1] stra 1 int swap = a[x-1]; swap a[x-1] a x-1 x 1 a[x-1] = a[y-1] a[x-1] a x-1 x 1 a[y-1] a y-1 y 1 a[y-1] = swap a[y-1] a y-1 y 1 swap for(int z : a){
			System.out.println(z);
		} int z a {
			System.out.println(z);
		} {
			System.out.println(z);
		} System.out.println(z) System.out.println System.out System System.out z sc.close() sc.close sc 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[] a = new int[w];
		for(int i = 0 ; i < a.length ; i++){
			a[i] = i+1;
		}
		
		for (int i = 0 ; i < n ; i++){
			String str = sc.next();
			String[] stra = str.split(",");
			int x = Integer.parseInt(stra[0]);
			int y = Integer.parseInt(stra[1]);
			int swap = a[x-1];
			a[x-1] = a[y-1];
			a[y-1] = swap;
		}
		for(int z : a){
			System.out.println(z);
		}
		sc.close();
	}

} public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] a = new int[w];
		for(int i = 0 ; i < a.length ; i++){
			a[i] = i+1;
		}
		
		for (int i = 0 ; i < n ; i++){
			String str = sc.next();
			String[] stra = str.split(",");
			int x = Integer.parseInt(stra[0]);
			int y = Integer.parseInt(stra[1]);
			int swap = a[x-1];
			a[x-1] = a[y-1];
			a[y-1] = swap;
		}
		for(int z : a){
			System.out.println(z);
		}
		sc.close();
	}

} 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[] a = new int[w];
		for(int i = 0 ; i < a.length ; i++){
			a[i] = i+1;
		}
		
		for (int i = 0 ; i < n ; i++){
			String str = sc.next();
			String[] stra = str.split(",");
			int x = Integer.parseInt(stra[0]);
			int y = Integer.parseInt(stra[1]);
			int swap = a[x-1];
			a[x-1] = a[y-1];
			a[y-1] = swap;
		}
		for(int z : a){
			System.out.println(z);
		}
		sc.close();
	}

}