import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int w = scan.nextInt();
		int[] dl = new int[w];
		for(int i = 0; i < w; i++){
			dl[i] = i + 1;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String input = scan.next();
			String[] nums = input.split(",");
			int a = Integer.parseInt(nums[0]);
			int b = Integer.parseInt(nums[1]);
			int work = dl[a - 1];
			dl[a - 1] = dl[b - 1];
			dl[b - 1] = work;
		}

		for(int i = 0; i < w; i++){
			System.out.printf("%d\n", dl[i]);
		}
	}
} import java.util.*; util.* java public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int w = scan.nextInt();
		int[] dl = new int[w];
		for(int i = 0; i < w; i++){
			dl[i] = i + 1;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String input = scan.next();
			String[] nums = input.split(",");
			int a = Integer.parseInt(nums[0]);
			int b = Integer.parseInt(nums[1]);
			int work = dl[a - 1];
			dl[a - 1] = dl[b - 1];
			dl[b - 1] = work;
		}

		for(int i = 0; i < w; i++){
			System.out.printf("%d\n", dl[i]);
		}
	}
} Main private static final Scanner scan = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[] args){
		int w = scan.nextInt();
		int[] dl = new int[w];
		for(int i = 0; i < w; i++){
			dl[i] = i + 1;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String input = scan.next();
			String[] nums = input.split(",");
			int a = Integer.parseInt(nums[0]);
			int b = Integer.parseInt(nums[1]);
			int work = dl[a - 1];
			dl[a - 1] = dl[b - 1];
			dl[b - 1] = work;
		}

		for(int i = 0; i < w; i++){
			System.out.printf("%d\n", dl[i]);
		}
	} main {
		int w = scan.nextInt();
		int[] dl = new int[w];
		for(int i = 0; i < w; i++){
			dl[i] = i + 1;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String input = scan.next();
			String[] nums = input.split(",");
			int a = Integer.parseInt(nums[0]);
			int b = Integer.parseInt(nums[1]);
			int work = dl[a - 1];
			dl[a - 1] = dl[b - 1];
			dl[b - 1] = work;
		}

		for(int i = 0; i < w; i++){
			System.out.printf("%d\n", dl[i]);
		}
	} int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan int[] dl = new int[w]; dl new int[w] w for(int i = 0; i < w; i++){
			dl[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			dl[i] = i + 1;
		} {
			dl[i] = i + 1;
		} dl[i] = i + 1 dl[i] dl i i + 1 i 1 int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan for(int i = 0; i < n; i++){
			String input = scan.next();
			String[] nums = input.split(",");
			int a = Integer.parseInt(nums[0]);
			int b = Integer.parseInt(nums[1]);
			int work = dl[a - 1];
			dl[a - 1] = dl[b - 1];
			dl[b - 1] = work;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String input = scan.next();
			String[] nums = input.split(",");
			int a = Integer.parseInt(nums[0]);
			int b = Integer.parseInt(nums[1]);
			int work = dl[a - 1];
			dl[a - 1] = dl[b - 1];
			dl[b - 1] = work;
		} {
			String input = scan.next();
			String[] nums = input.split(",");
			int a = Integer.parseInt(nums[0]);
			int b = Integer.parseInt(nums[1]);
			int work = dl[a - 1];
			dl[a - 1] = dl[b - 1];
			dl[b - 1] = work;
		} String input = scan.next(); input scan.next() scan.next scan String[] nums = input.split(","); nums input.split(",") input.split input "," int a = Integer.parseInt(nums[0]); a Integer.parseInt(nums[0]) Integer.parseInt Integer nums[0] nums 0 int b = Integer.parseInt(nums[1]); b Integer.parseInt(nums[1]) Integer.parseInt Integer nums[1] nums 1 int work = dl[a - 1]; work dl[a - 1] dl a - 1 a 1 dl[a - 1] = dl[b - 1] dl[a - 1] dl a - 1 a 1 dl[b - 1] dl b - 1 b 1 dl[b - 1] = work dl[b - 1] dl b - 1 b 1 work for(int i = 0; i < w; i++){
			System.out.printf("%d\n", dl[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.printf("%d\n", dl[i]);
		} {
			System.out.printf("%d\n", dl[i]);
		} System.out.printf("%d\n", dl[i]) System.out.printf System.out System System.out "%d\n" dl[i] dl i String[] args args public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int w = scan.nextInt();
		int[] dl = new int[w];
		for(int i = 0; i < w; i++){
			dl[i] = i + 1;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String input = scan.next();
			String[] nums = input.split(",");
			int a = Integer.parseInt(nums[0]);
			int b = Integer.parseInt(nums[1]);
			int work = dl[a - 1];
			dl[a - 1] = dl[b - 1];
			dl[b - 1] = work;
		}

		for(int i = 0; i < w; i++){
			System.out.printf("%d\n", dl[i]);
		}
	}
} public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int w = scan.nextInt();
		int[] dl = new int[w];
		for(int i = 0; i < w; i++){
			dl[i] = i + 1;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String input = scan.next();
			String[] nums = input.split(",");
			int a = Integer.parseInt(nums[0]);
			int b = Integer.parseInt(nums[1]);
			int work = dl[a - 1];
			dl[a - 1] = dl[b - 1];
			dl[b - 1] = work;
		}

		for(int i = 0; i < w; i++){
			System.out.printf("%d\n", dl[i]);
		}
	}
} Main
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int w = scan.nextInt();
		int[] dl = new int[w];
		for(int i = 0; i < w; i++){
			dl[i] = i + 1;
		}
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			String input = scan.next();
			String[] nums = input.split(",");
			int a = Integer.parseInt(nums[0]);
			int b = Integer.parseInt(nums[1]);
			int work = dl[a - 1];
			dl[a - 1] = dl[b - 1];
			dl[b - 1] = work;
		}

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