import java.util.Scanner;
class Main{
	public static void main(String[] a){
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int[] line = new int[w + 1];
		for(int i = 1; i <= w; i++){
			line[i] = i;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String str = scan.next();
			String[] spl = str.split(",");
			int num1 = Integer.parseInt(spl[0]);
			int num2 = Integer.parseInt(spl[1]);
			int sub = line[num1];
			line[num1] = line[num2];
			line[num2] = sub;
		}
		for(int i = 1; i <= w; i++){
			System.out.println(line[i]);
		}
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] a){
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int[] line = new int[w + 1];
		for(int i = 1; i <= w; i++){
			line[i] = i;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String str = scan.next();
			String[] spl = str.split(",");
			int num1 = Integer.parseInt(spl[0]);
			int num2 = Integer.parseInt(spl[1]);
			int sub = line[num1];
			line[num1] = line[num2];
			line[num2] = sub;
		}
		for(int i = 1; i <= w; i++){
			System.out.println(line[i]);
		}
	}
} Main public static void main(String[] a){
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int[] line = new int[w + 1];
		for(int i = 1; i <= w; i++){
			line[i] = i;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String str = scan.next();
			String[] spl = str.split(",");
			int num1 = Integer.parseInt(spl[0]);
			int num2 = Integer.parseInt(spl[1]);
			int sub = line[num1];
			line[num1] = line[num2];
			line[num2] = sub;
		}
		for(int i = 1; i <= w; i++){
			System.out.println(line[i]);
		}
	} main {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int[] line = new int[w + 1];
		for(int i = 1; i <= w; i++){
			line[i] = i;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String str = scan.next();
			String[] spl = str.split(",");
			int num1 = Integer.parseInt(spl[0]);
			int num2 = Integer.parseInt(spl[1]);
			int sub = line[num1];
			line[num1] = line[num2];
			line[num2] = sub;
		}
		for(int i = 1; i <= w; i++){
			System.out.println(line[i]);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan int[] line = new int[w + 1]; line new int[w + 1] w + 1 w 1 for(int i = 1; i <= w; i++){
			line[i] = i;
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			line[i] = i;
		} {
			line[i] = i;
		} line[i] = i line[i] line i i int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan for(int i = 0; i < n; i++){
			String str = scan.next();
			String[] spl = str.split(",");
			int num1 = Integer.parseInt(spl[0]);
			int num2 = Integer.parseInt(spl[1]);
			int sub = line[num1];
			line[num1] = line[num2];
			line[num2] = sub;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String str = scan.next();
			String[] spl = str.split(",");
			int num1 = Integer.parseInt(spl[0]);
			int num2 = Integer.parseInt(spl[1]);
			int sub = line[num1];
			line[num1] = line[num2];
			line[num2] = sub;
		} {
			String str = scan.next();
			String[] spl = str.split(",");
			int num1 = Integer.parseInt(spl[0]);
			int num2 = Integer.parseInt(spl[1]);
			int sub = line[num1];
			line[num1] = line[num2];
			line[num2] = sub;
		} String str = scan.next(); str scan.next() scan.next scan String[] spl = str.split(","); spl str.split(",") str.split str "," int num1 = Integer.parseInt(spl[0]); num1 Integer.parseInt(spl[0]) Integer.parseInt Integer spl[0] spl 0 int num2 = Integer.parseInt(spl[1]); num2 Integer.parseInt(spl[1]) Integer.parseInt Integer spl[1] spl 1 int sub = line[num1]; sub line[num1] line num1 line[num1] = line[num2] line[num1] line num1 line[num2] line num2 line[num2] = sub line[num2] line num2 sub for(int i = 1; i <= w; i++){
			System.out.println(line[i]);
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			System.out.println(line[i]);
		} {
			System.out.println(line[i]);
		} System.out.println(line[i]) System.out.println System.out System System.out line[i] line i String[] a a
import java.util.Scanner;
class Main{
	public static void main(String[] a){
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int[] line = new int[w + 1];
		for(int i = 1; i <= w; i++){
			line[i] = i;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String str = scan.next();
			String[] spl = str.split(",");
			int num1 = Integer.parseInt(spl[0]);
			int num2 = Integer.parseInt(spl[1]);
			int sub = line[num1];
			line[num1] = line[num2];
			line[num2] = sub;
		}
		for(int i = 1; i <= w; i++){
			System.out.println(line[i]);
		}
	}
}