import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] nums = new int[w];
		for(int i = 0; i < w; i++){
			nums[i] = i+1;	
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String input = sc.next();
			String[] resultInput = input.split(",");
			int a = Integer.parseInt(resultInput[0]);
			int b = Integer.parseInt(resultInput[1]);
			nums = swap(nums, a, b);
		}
		for(int i = 0; i < w; i++){
			System.out.println(nums[i]);
		}
	}

	public static int[] swap(int[] nums, int a, int b){
		a -= 1;
		b -= 1;
		int tmp = nums[a];
		nums[a] = nums[b];
		nums[b] = tmp;
		return nums;
	}
} import java.util.*; util.* java public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] nums = new int[w];
		for(int i = 0; i < w; i++){
			nums[i] = i+1;	
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String input = sc.next();
			String[] resultInput = input.split(",");
			int a = Integer.parseInt(resultInput[0]);
			int b = Integer.parseInt(resultInput[1]);
			nums = swap(nums, a, b);
		}
		for(int i = 0; i < w; i++){
			System.out.println(nums[i]);
		}
	}

	public static int[] swap(int[] nums, int a, int b){
		a -= 1;
		b -= 1;
		int tmp = nums[a];
		nums[a] = nums[b];
		nums[b] = tmp;
		return nums;
	}
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] nums = new int[w];
		for(int i = 0; i < w; i++){
			nums[i] = i+1;	
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String input = sc.next();
			String[] resultInput = input.split(",");
			int a = Integer.parseInt(resultInput[0]);
			int b = Integer.parseInt(resultInput[1]);
			nums = swap(nums, a, b);
		}
		for(int i = 0; i < w; i++){
			System.out.println(nums[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] nums = new int[w];
		for(int i = 0; i < w; i++){
			nums[i] = i+1;	
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String input = sc.next();
			String[] resultInput = input.split(",");
			int a = Integer.parseInt(resultInput[0]);
			int b = Integer.parseInt(resultInput[1]);
			nums = swap(nums, a, b);
		}
		for(int i = 0; i < w; i++){
			System.out.println(nums[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int[] nums = new int[w]; nums new int[w] w for(int i = 0; i < w; i++){
			nums[i] = i+1;	
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			nums[i] = i+1;	
		} {
			nums[i] = i+1;	
		} nums[i] = i+1 nums[i] nums i i+1 i 1 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i = 0; i < n; i++){
			String input = sc.next();
			String[] resultInput = input.split(",");
			int a = Integer.parseInt(resultInput[0]);
			int b = Integer.parseInt(resultInput[1]);
			nums = swap(nums, a, b);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String input = sc.next();
			String[] resultInput = input.split(",");
			int a = Integer.parseInt(resultInput[0]);
			int b = Integer.parseInt(resultInput[1]);
			nums = swap(nums, a, b);
		} {
			String input = sc.next();
			String[] resultInput = input.split(",");
			int a = Integer.parseInt(resultInput[0]);
			int b = Integer.parseInt(resultInput[1]);
			nums = swap(nums, a, b);
		} String input = sc.next(); input sc.next() sc.next sc String[] resultInput = input.split(","); resultInput input.split(",") input.split input "," int a = Integer.parseInt(resultInput[0]); a Integer.parseInt(resultInput[0]) Integer.parseInt Integer resultInput[0] resultInput 0 int b = Integer.parseInt(resultInput[1]); b Integer.parseInt(resultInput[1]) Integer.parseInt Integer resultInput[1] resultInput 1 nums = swap(nums, a, b) nums swap(nums, a, b) swap nums a b for(int i = 0; i < w; i++){
			System.out.println(nums[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(nums[i]);
		} {
			System.out.println(nums[i]);
		} System.out.println(nums[i]) System.out.println System.out System System.out nums[i] nums i String args[] args public static int[] swap(int[] nums, int a, int b){
		a -= 1;
		b -= 1;
		int tmp = nums[a];
		nums[a] = nums[b];
		nums[b] = tmp;
		return nums;
	} swap {
		a -= 1;
		b -= 1;
		int tmp = nums[a];
		nums[a] = nums[b];
		nums[b] = tmp;
		return nums;
	} a -= 1 a 1 b -= 1 b 1 int tmp = nums[a]; tmp nums[a] nums a nums[a] = nums[b] nums[a] nums a nums[b] nums b nums[b] = tmp nums[b] nums b tmp return nums; nums int[] nums nums int a a int b b public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] nums = new int[w];
		for(int i = 0; i < w; i++){
			nums[i] = i+1;	
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String input = sc.next();
			String[] resultInput = input.split(",");
			int a = Integer.parseInt(resultInput[0]);
			int b = Integer.parseInt(resultInput[1]);
			nums = swap(nums, a, b);
		}
		for(int i = 0; i < w; i++){
			System.out.println(nums[i]);
		}
	}

	public static int[] swap(int[] nums, int a, int b){
		a -= 1;
		b -= 1;
		int tmp = nums[a];
		nums[a] = nums[b];
		nums[b] = tmp;
		return nums;
	}
} public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] nums = new int[w];
		for(int i = 0; i < w; i++){
			nums[i] = i+1;	
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String input = sc.next();
			String[] resultInput = input.split(",");
			int a = Integer.parseInt(resultInput[0]);
			int b = Integer.parseInt(resultInput[1]);
			nums = swap(nums, a, b);
		}
		for(int i = 0; i < w; i++){
			System.out.println(nums[i]);
		}
	}

	public static int[] swap(int[] nums, int a, int b){
		a -= 1;
		b -= 1;
		int tmp = nums[a];
		nums[a] = nums[b];
		nums[b] = tmp;
		return nums;
	}
} Main
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] nums = new int[w];
		for(int i = 0; i < w; i++){
			nums[i] = i+1;	
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String input = sc.next();
			String[] resultInput = input.split(",");
			int a = Integer.parseInt(resultInput[0]);
			int b = Integer.parseInt(resultInput[1]);
			nums = swap(nums, a, b);
		}
		for(int i = 0; i < w; i++){
			System.out.println(nums[i]);
		}
	}

	public static int[] swap(int[] nums, int a, int b){
		a -= 1;
		b -= 1;
		int tmp = nums[a];
		nums[a] = nums[b];
		nums[b] = tmp;
		return nums;
	}
}