import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter(",|//s|\n");
		int w = Integer.parseInt(scan.next());
		int n = Integer.parseInt(scan.next());
		int[] number = new int[w];
		for( int i = 0; i < w; i++){
			number[i] = i+1;
		}
		for( int i = 0; i < n; i++ ){
			int a = Integer.parseInt(scan.next()) - 1;
			int b = Integer.parseInt(scan.next()) - 1;
			int temp = number[a];
			number[a] = number[b];
			number[b] = temp;
		}
		for( int i = 0; i < w; i++ ){
			System.out.println(number[i]);
		}
		return;
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter(",|//s|\n");
		int w = Integer.parseInt(scan.next());
		int n = Integer.parseInt(scan.next());
		int[] number = new int[w];
		for( int i = 0; i < w; i++){
			number[i] = i+1;
		}
		for( int i = 0; i < n; i++ ){
			int a = Integer.parseInt(scan.next()) - 1;
			int b = Integer.parseInt(scan.next()) - 1;
			int temp = number[a];
			number[a] = number[b];
			number[b] = temp;
		}
		for( int i = 0; i < w; i++ ){
			System.out.println(number[i]);
		}
		return;
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter(",|//s|\n");
		int w = Integer.parseInt(scan.next());
		int n = Integer.parseInt(scan.next());
		int[] number = new int[w];
		for( int i = 0; i < w; i++){
			number[i] = i+1;
		}
		for( int i = 0; i < n; i++ ){
			int a = Integer.parseInt(scan.next()) - 1;
			int b = Integer.parseInt(scan.next()) - 1;
			int temp = number[a];
			number[a] = number[b];
			number[b] = temp;
		}
		for( int i = 0; i < w; i++ ){
			System.out.println(number[i]);
		}
		return;
	} main {
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter(",|//s|\n");
		int w = Integer.parseInt(scan.next());
		int n = Integer.parseInt(scan.next());
		int[] number = new int[w];
		for( int i = 0; i < w; i++){
			number[i] = i+1;
		}
		for( int i = 0; i < n; i++ ){
			int a = Integer.parseInt(scan.next()) - 1;
			int b = Integer.parseInt(scan.next()) - 1;
			int temp = number[a];
			number[a] = number[b];
			number[b] = temp;
		}
		for( int i = 0; i < w; i++ ){
			System.out.println(number[i]);
		}
		return;
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) scan.useDelimiter(",|//s|\n") scan.useDelimiter scan ",|//s|\n" int w = Integer.parseInt(scan.next()); w Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int n = Integer.parseInt(scan.next()); n Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int[] number = new int[w]; number new int[w] w for( int i = 0; i < w; i++){
			number[i] = i+1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			number[i] = i+1;
		} {
			number[i] = i+1;
		} number[i] = i+1 number[i] number i i+1 i 1 for( int i = 0; i < n; i++ ){
			int a = Integer.parseInt(scan.next()) - 1;
			int b = Integer.parseInt(scan.next()) - 1;
			int temp = number[a];
			number[a] = number[b];
			number[b] = temp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int a = Integer.parseInt(scan.next()) - 1;
			int b = Integer.parseInt(scan.next()) - 1;
			int temp = number[a];
			number[a] = number[b];
			number[b] = temp;
		} {
			int a = Integer.parseInt(scan.next()) - 1;
			int b = Integer.parseInt(scan.next()) - 1;
			int temp = number[a];
			number[a] = number[b];
			number[b] = temp;
		} int a = Integer.parseInt(scan.next()) - 1; a Integer.parseInt(scan.next()) - 1 Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan 1 int b = Integer.parseInt(scan.next()) - 1; b Integer.parseInt(scan.next()) - 1 Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan 1 int temp = number[a]; temp number[a] number a number[a] = number[b] number[a] number a number[b] number b number[b] = temp number[b] number b temp for( int i = 0; i < w; i++ ){
			System.out.println(number[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(number[i]);
		} {
			System.out.println(number[i]);
		} System.out.println(number[i]) System.out.println System.out System System.out number[i] number i return; String[] args args public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter(",|//s|\n");
		int w = Integer.parseInt(scan.next());
		int n = Integer.parseInt(scan.next());
		int[] number = new int[w];
		for( int i = 0; i < w; i++){
			number[i] = i+1;
		}
		for( int i = 0; i < n; i++ ){
			int a = Integer.parseInt(scan.next()) - 1;
			int b = Integer.parseInt(scan.next()) - 1;
			int temp = number[a];
			number[a] = number[b];
			number[b] = temp;
		}
		for( int i = 0; i < w; i++ ){
			System.out.println(number[i]);
		}
		return;
	}
} public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter(",|//s|\n");
		int w = Integer.parseInt(scan.next());
		int n = Integer.parseInt(scan.next());
		int[] number = new int[w];
		for( int i = 0; i < w; i++){
			number[i] = i+1;
		}
		for( int i = 0; i < n; i++ ){
			int a = Integer.parseInt(scan.next()) - 1;
			int b = Integer.parseInt(scan.next()) - 1;
			int temp = number[a];
			number[a] = number[b];
			number[b] = temp;
		}
		for( int i = 0; i < w; i++ ){
			System.out.println(number[i]);
		}
		return;
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter(",|//s|\n");
		int w = Integer.parseInt(scan.next());
		int n = Integer.parseInt(scan.next());
		int[] number = new int[w];
		for( int i = 0; i < w; i++){
			number[i] = i+1;
		}
		for( int i = 0; i < n; i++ ){
			int a = Integer.parseInt(scan.next()) - 1;
			int b = Integer.parseInt(scan.next()) - 1;
			int temp = number[a];
			number[a] = number[b];
			number[b] = temp;
		}
		for( int i = 0; i < w; i++ ){
			System.out.println(number[i]);
		}
		return;
	}
}