import java.util.Scanner;
import java.util.regex.*;

class Main {

    public static void main(String[] args){

	Scanner stdin = new Scanner(System.in).useDelimiter("[ \t,\n]");
	int n = stdin.nextInt();
	int line = stdin.nextInt();

	int[] nums = new int[n + 1];
	for(int i = 1; i <= n; i++){
	    nums[i] = i;
	}
	stdin.nextLine();
	for(int i = 0; i < line; i++){
	    int sw1 = stdin.nextInt();
	    int sw2 = stdin.nextInt();
	    int temp = nums[sw1];
	    nums[sw1] = nums[sw2];
	    nums[sw2] = temp;
	}
	for(int i = 1; i <= n; i++){
	    System.out.println(nums[i]);
	}
    }
}
	
	 import java.util.Scanner; Scanner java.util import java.util.regex.*; regex.* java.util class Main {

    public static void main(String[] args){

	Scanner stdin = new Scanner(System.in).useDelimiter("[ \t,\n]");
	int n = stdin.nextInt();
	int line = stdin.nextInt();

	int[] nums = new int[n + 1];
	for(int i = 1; i <= n; i++){
	    nums[i] = i;
	}
	stdin.nextLine();
	for(int i = 0; i < line; i++){
	    int sw1 = stdin.nextInt();
	    int sw2 = stdin.nextInt();
	    int temp = nums[sw1];
	    nums[sw1] = nums[sw2];
	    nums[sw2] = temp;
	}
	for(int i = 1; i <= n; i++){
	    System.out.println(nums[i]);
	}
    }
} Main public static void main(String[] args){

	Scanner stdin = new Scanner(System.in).useDelimiter("[ \t,\n]");
	int n = stdin.nextInt();
	int line = stdin.nextInt();

	int[] nums = new int[n + 1];
	for(int i = 1; i <= n; i++){
	    nums[i] = i;
	}
	stdin.nextLine();
	for(int i = 0; i < line; i++){
	    int sw1 = stdin.nextInt();
	    int sw2 = stdin.nextInt();
	    int temp = nums[sw1];
	    nums[sw1] = nums[sw2];
	    nums[sw2] = temp;
	}
	for(int i = 1; i <= n; i++){
	    System.out.println(nums[i]);
	}
    } main {

	Scanner stdin = new Scanner(System.in).useDelimiter("[ \t,\n]");
	int n = stdin.nextInt();
	int line = stdin.nextInt();

	int[] nums = new int[n + 1];
	for(int i = 1; i <= n; i++){
	    nums[i] = i;
	}
	stdin.nextLine();
	for(int i = 0; i < line; i++){
	    int sw1 = stdin.nextInt();
	    int sw2 = stdin.nextInt();
	    int temp = nums[sw1];
	    nums[sw1] = nums[sw2];
	    nums[sw2] = temp;
	}
	for(int i = 1; i <= n; i++){
	    System.out.println(nums[i]);
	}
    } Scanner stdin = new Scanner(System.in).useDelimiter("[ \t,\n]"); stdin new Scanner(System.in).useDelimiter("[ \t,\n]") new Scanner(System.in).useDelimiter new Scanner(System.in) "[ \t,\n]" int n = stdin.nextInt(); n stdin.nextInt() stdin.nextInt stdin int line = stdin.nextInt(); line stdin.nextInt() stdin.nextInt stdin int[] nums = new int[n + 1]; nums new int[n + 1] n + 1 n 1 for(int i = 1; i <= n; i++){
	    nums[i] = i;
	} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
	    nums[i] = i;
	} {
	    nums[i] = i;
	} nums[i] = i nums[i] nums i i stdin.nextLine() stdin.nextLine stdin for(int i = 0; i < line; i++){
	    int sw1 = stdin.nextInt();
	    int sw2 = stdin.nextInt();
	    int temp = nums[sw1];
	    nums[sw1] = nums[sw2];
	    nums[sw2] = temp;
	} int i = 0; int i = 0; i 0 i < line i line i++ i++ i {
	    int sw1 = stdin.nextInt();
	    int sw2 = stdin.nextInt();
	    int temp = nums[sw1];
	    nums[sw1] = nums[sw2];
	    nums[sw2] = temp;
	} {
	    int sw1 = stdin.nextInt();
	    int sw2 = stdin.nextInt();
	    int temp = nums[sw1];
	    nums[sw1] = nums[sw2];
	    nums[sw2] = temp;
	} int sw1 = stdin.nextInt(); sw1 stdin.nextInt() stdin.nextInt stdin int sw2 = stdin.nextInt(); sw2 stdin.nextInt() stdin.nextInt stdin int temp = nums[sw1]; temp nums[sw1] nums sw1 nums[sw1] = nums[sw2] nums[sw1] nums sw1 nums[sw2] nums sw2 nums[sw2] = temp nums[sw2] nums sw2 temp for(int i = 1; i <= n; i++){
	    System.out.println(nums[i]);
	} int i = 1; int i = 1; i 1 i <= n i n 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
import java.util.Scanner;
import java.util.regex.*;

class Main {

    public static void main(String[] args){

	Scanner stdin = new Scanner(System.in).useDelimiter("[ \t,\n]");
	int n = stdin.nextInt();
	int line = stdin.nextInt();

	int[] nums = new int[n + 1];
	for(int i = 1; i <= n; i++){
	    nums[i] = i;
	}
	stdin.nextLine();
	for(int i = 0; i < line; i++){
	    int sw1 = stdin.nextInt();
	    int sw2 = stdin.nextInt();
	    int temp = nums[sw1];
	    nums[sw1] = nums[sw2];
	    nums[sw2] = temp;
	}
	for(int i = 1; i <= n; i++){
	    System.out.println(nums[i]);
	}
    }
}
	
	