import java.util.Scanner;


public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int line = Integer.parseInt(sc.nextLine());
		int n = Integer.parseInt(sc.nextLine());

		int[] values = new int[line];
		for(int i=0;i<line;i++){
			values[i] = i+1;
		}

		for(int i=0;i<n;i++){
			String[] s = sc.nextLine().split(",");
			int a = Integer.parseInt(s[0]);
			int b= Integer.parseInt(s[1]);

			int value = values[a-1];
			values[a-1] = values[b-1];
			values[b-1] = value;
		}

		for(int i=0;i<line;i++){
			System.out.println(values[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int line = Integer.parseInt(sc.nextLine());
		int n = Integer.parseInt(sc.nextLine());

		int[] values = new int[line];
		for(int i=0;i<line;i++){
			values[i] = i+1;
		}

		for(int i=0;i<n;i++){
			String[] s = sc.nextLine().split(",");
			int a = Integer.parseInt(s[0]);
			int b= Integer.parseInt(s[1]);

			int value = values[a-1];
			values[a-1] = values[b-1];
			values[b-1] = value;
		}

		for(int i=0;i<line;i++){
			System.out.println(values[i]);
		}
	}
} Main public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int line = Integer.parseInt(sc.nextLine());
		int n = Integer.parseInt(sc.nextLine());

		int[] values = new int[line];
		for(int i=0;i<line;i++){
			values[i] = i+1;
		}

		for(int i=0;i<n;i++){
			String[] s = sc.nextLine().split(",");
			int a = Integer.parseInt(s[0]);
			int b= Integer.parseInt(s[1]);

			int value = values[a-1];
			values[a-1] = values[b-1];
			values[b-1] = value;
		}

		for(int i=0;i<line;i++){
			System.out.println(values[i]);
		}
	} main {

		Scanner sc = new Scanner(System.in);
		int line = Integer.parseInt(sc.nextLine());
		int n = Integer.parseInt(sc.nextLine());

		int[] values = new int[line];
		for(int i=0;i<line;i++){
			values[i] = i+1;
		}

		for(int i=0;i<n;i++){
			String[] s = sc.nextLine().split(",");
			int a = Integer.parseInt(s[0]);
			int b= Integer.parseInt(s[1]);

			int value = values[a-1];
			values[a-1] = values[b-1];
			values[b-1] = value;
		}

		for(int i=0;i<line;i++){
			System.out.println(values[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int line = Integer.parseInt(sc.nextLine()); line Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int[] values = new int[line]; values new int[line] line for(int i=0;i<line;i++){
			values[i] = i+1;
		} int i=0; int i=0; i 0 i<line i line i++ i++ i {
			values[i] = i+1;
		} {
			values[i] = i+1;
		} values[i] = i+1 values[i] values i i+1 i 1 for(int i=0;i<n;i++){
			String[] s = sc.nextLine().split(",");
			int a = Integer.parseInt(s[0]);
			int b= Integer.parseInt(s[1]);

			int value = values[a-1];
			values[a-1] = values[b-1];
			values[b-1] = value;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String[] s = sc.nextLine().split(",");
			int a = Integer.parseInt(s[0]);
			int b= Integer.parseInt(s[1]);

			int value = values[a-1];
			values[a-1] = values[b-1];
			values[b-1] = value;
		} {
			String[] s = sc.nextLine().split(",");
			int a = Integer.parseInt(s[0]);
			int b= Integer.parseInt(s[1]);

			int value = values[a-1];
			values[a-1] = values[b-1];
			values[b-1] = value;
		} String[] s = sc.nextLine().split(","); s sc.nextLine().split(",") sc.nextLine().split sc.nextLine() sc.nextLine sc "," int a = Integer.parseInt(s[0]); a Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int b= Integer.parseInt(s[1]); b Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 int value = values[a-1]; value values[a-1] values a-1 a 1 values[a-1] = values[b-1] values[a-1] values a-1 a 1 values[b-1] values b-1 b 1 values[b-1] = value values[b-1] values b-1 b 1 value for(int i=0;i<line;i++){
			System.out.println(values[i]);
		} int i=0; int i=0; i 0 i<line i line i++ i++ i {
			System.out.println(values[i]);
		} {
			System.out.println(values[i]);
		} System.out.println(values[i]) System.out.println System.out System System.out values[i] values i String[] args args public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int line = Integer.parseInt(sc.nextLine());
		int n = Integer.parseInt(sc.nextLine());

		int[] values = new int[line];
		for(int i=0;i<line;i++){
			values[i] = i+1;
		}

		for(int i=0;i<n;i++){
			String[] s = sc.nextLine().split(",");
			int a = Integer.parseInt(s[0]);
			int b= Integer.parseInt(s[1]);

			int value = values[a-1];
			values[a-1] = values[b-1];
			values[b-1] = value;
		}

		for(int i=0;i<line;i++){
			System.out.println(values[i]);
		}
	}
} public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int line = Integer.parseInt(sc.nextLine());
		int n = Integer.parseInt(sc.nextLine());

		int[] values = new int[line];
		for(int i=0;i<line;i++){
			values[i] = i+1;
		}

		for(int i=0;i<n;i++){
			String[] s = sc.nextLine().split(",");
			int a = Integer.parseInt(s[0]);
			int b= Integer.parseInt(s[1]);

			int value = values[a-1];
			values[a-1] = values[b-1];
			values[b-1] = value;
		}

		for(int i=0;i<line;i++){
			System.out.println(values[i]);
		}
	}
} Main
import java.util.Scanner;


public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int line = Integer.parseInt(sc.nextLine());
		int n = Integer.parseInt(sc.nextLine());

		int[] values = new int[line];
		for(int i=0;i<line;i++){
			values[i] = i+1;
		}

		for(int i=0;i<n;i++){
			String[] s = sc.nextLine().split(",");
			int a = Integer.parseInt(s[0]);
			int b= Integer.parseInt(s[1]);

			int value = values[a-1];
			values[a-1] = values[b-1];
			values[b-1] = value;
		}

		for(int i=0;i<line;i++){
			System.out.println(values[i]);
		}
	}
}