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[] num = new int[w];
		for(int i = 0;i < num.length;i++) {
			num[i] = i+1;
		}
		for(int i = 0;i<n;i++) {
			String ab_st = sc.next();
			String[] ab = ab_st.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;

			int sub=0;
			sub = num[a];
			num[a] = num[b];
			num[b] = sub;

		}
		for(int i = 0;i < num.length;i++) {
			System.out.printf("%d\n",num[i]);
		}
		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[] num = new int[w];
		for(int i = 0;i < num.length;i++) {
			num[i] = i+1;
		}
		for(int i = 0;i<n;i++) {
			String ab_st = sc.next();
			String[] ab = ab_st.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;

			int sub=0;
			sub = num[a];
			num[a] = num[b];
			num[b] = sub;

		}
		for(int i = 0;i < num.length;i++) {
			System.out.printf("%d\n",num[i]);
		}
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] num = new int[w];
		for(int i = 0;i < num.length;i++) {
			num[i] = i+1;
		}
		for(int i = 0;i<n;i++) {
			String ab_st = sc.next();
			String[] ab = ab_st.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;

			int sub=0;
			sub = num[a];
			num[a] = num[b];
			num[b] = sub;

		}
		for(int i = 0;i < num.length;i++) {
			System.out.printf("%d\n",num[i]);
		}
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] num = new int[w];
		for(int i = 0;i < num.length;i++) {
			num[i] = i+1;
		}
		for(int i = 0;i<n;i++) {
			String ab_st = sc.next();
			String[] ab = ab_st.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;

			int sub=0;
			sub = num[a];
			num[a] = num[b];
			num[b] = sub;

		}
		for(int i = 0;i < num.length;i++) {
			System.out.printf("%d\n",num[i]);
		}
		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[] num = new int[w]; num new int[w] w for(int i = 0;i < num.length;i++) {
			num[i] = i+1;
		} int i = 0; int i = 0; i 0 i < num.length i num.length num num.length i++ i++ i {
			num[i] = i+1;
		} {
			num[i] = i+1;
		} num[i] = i+1 num[i] num i i+1 i 1 for(int i = 0;i<n;i++) {
			String ab_st = sc.next();
			String[] ab = ab_st.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;

			int sub=0;
			sub = num[a];
			num[a] = num[b];
			num[b] = sub;

		} int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
			String ab_st = sc.next();
			String[] ab = ab_st.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;

			int sub=0;
			sub = num[a];
			num[a] = num[b];
			num[b] = sub;

		} {
			String ab_st = sc.next();
			String[] ab = ab_st.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;

			int sub=0;
			sub = num[a];
			num[a] = num[b];
			num[b] = sub;

		} String ab_st = sc.next(); ab_st sc.next() sc.next sc String[] ab = ab_st.split(","); ab ab_st.split(",") ab_st.split ab_st "," int a = Integer.parseInt(ab[0]) - 1; a Integer.parseInt(ab[0]) - 1 Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 1 int b = Integer.parseInt(ab[1]) - 1; b Integer.parseInt(ab[1]) - 1 Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 1 int sub=0; sub 0 sub = num[a] sub num[a] num a num[a] = num[b] num[a] num a num[b] num b num[b] = sub num[b] num b sub for(int i = 0;i < num.length;i++) {
			System.out.printf("%d\n",num[i]);
		} int i = 0; int i = 0; i 0 i < num.length i num.length num num.length i++ i++ i {
			System.out.printf("%d\n",num[i]);
		} {
			System.out.printf("%d\n",num[i]);
		} System.out.printf("%d\n",num[i]) System.out.printf System.out System System.out "%d\n" num[i] num i 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[] num = new int[w];
		for(int i = 0;i < num.length;i++) {
			num[i] = i+1;
		}
		for(int i = 0;i<n;i++) {
			String ab_st = sc.next();
			String[] ab = ab_st.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;

			int sub=0;
			sub = num[a];
			num[a] = num[b];
			num[b] = sub;

		}
		for(int i = 0;i < num.length;i++) {
			System.out.printf("%d\n",num[i]);
		}
		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[] num = new int[w];
		for(int i = 0;i < num.length;i++) {
			num[i] = i+1;
		}
		for(int i = 0;i<n;i++) {
			String ab_st = sc.next();
			String[] ab = ab_st.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;

			int sub=0;
			sub = num[a];
			num[a] = num[b];
			num[b] = sub;

		}
		for(int i = 0;i < num.length;i++) {
			System.out.printf("%d\n",num[i]);
		}
		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[] num = new int[w];
		for(int i = 0;i < num.length;i++) {
			num[i] = i+1;
		}
		for(int i = 0;i<n;i++) {
			String ab_st = sc.next();
			String[] ab = ab_st.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;

			int sub=0;
			sub = num[a];
			num[a] = num[b];
			num[b] = sub;

		}
		for(int i = 0;i < num.length;i++) {
			System.out.printf("%d\n",num[i]);
		}
		sc.close();
	}
}

