import java.util.*;

public class Main{

	public static void main(String[] args) {
		scan();
		
	}
	//??\????°???¨??¢??°
	public static void scan() {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("\\s*,\\s*|\n");
		int W = scanner.nextInt();
		int[] amida = Amida(W);
		int N = scanner.nextInt();
		int kari1 = 0;
		int kari2 = 0;
		int kari3 = 0;
		for(int i = 0; i < N ; i++){
			kari1 = scanner.nextInt();
			kari2 = scanner.nextInt();
			kari3 = amida[kari1-1];
			amida[kari1-1] = amida[kari2-1];
			amida[kari2-1] = kari3;
		}
		for(int i = 0; i < W ; i++){
			System.out.println(amida[i]);
		}
		scanner.close();
		return ;
	}
	
	public static int[] Amida(int W) {
		int[] amida = new int[W];
		for(int i = 0; i < W ; i++){
			amida[i] = i+1;
		}
		return amida;
	}
	
	
} import java.util.*; util.* java public class Main{

	public static void main(String[] args) {
		scan();
		
	}
	//??\????°???¨??¢??°
	public static void scan() {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("\\s*,\\s*|\n");
		int W = scanner.nextInt();
		int[] amida = Amida(W);
		int N = scanner.nextInt();
		int kari1 = 0;
		int kari2 = 0;
		int kari3 = 0;
		for(int i = 0; i < N ; i++){
			kari1 = scanner.nextInt();
			kari2 = scanner.nextInt();
			kari3 = amida[kari1-1];
			amida[kari1-1] = amida[kari2-1];
			amida[kari2-1] = kari3;
		}
		for(int i = 0; i < W ; i++){
			System.out.println(amida[i]);
		}
		scanner.close();
		return ;
	}
	
	public static int[] Amida(int W) {
		int[] amida = new int[W];
		for(int i = 0; i < W ; i++){
			amida[i] = i+1;
		}
		return amida;
	}
	
	
} Main public static void main(String[] args) {
		scan();
		
	} main {
		scan();
		
	} scan() scan String[] args args //??\????°???¨??¢??°
	public static void scan() {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("\\s*,\\s*|\n");
		int W = scanner.nextInt();
		int[] amida = Amida(W);
		int N = scanner.nextInt();
		int kari1 = 0;
		int kari2 = 0;
		int kari3 = 0;
		for(int i = 0; i < N ; i++){
			kari1 = scanner.nextInt();
			kari2 = scanner.nextInt();
			kari3 = amida[kari1-1];
			amida[kari1-1] = amida[kari2-1];
			amida[kari2-1] = kari3;
		}
		for(int i = 0; i < W ; i++){
			System.out.println(amida[i]);
		}
		scanner.close();
		return ;
	} scan {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("\\s*,\\s*|\n");
		int W = scanner.nextInt();
		int[] amida = Amida(W);
		int N = scanner.nextInt();
		int kari1 = 0;
		int kari2 = 0;
		int kari3 = 0;
		for(int i = 0; i < N ; i++){
			kari1 = scanner.nextInt();
			kari2 = scanner.nextInt();
			kari3 = amida[kari1-1];
			amida[kari1-1] = amida[kari2-1];
			amida[kari2-1] = kari3;
		}
		for(int i = 0; i < W ; i++){
			System.out.println(amida[i]);
		}
		scanner.close();
		return ;
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) scanner.useDelimiter("\\s*,\\s*|\n") scanner.useDelimiter scanner "\\s*,\\s*|\n" int W = scanner.nextInt(); W scanner.nextInt() scanner.nextInt scanner int[] amida = Amida(W); amida Amida(W) Amida W int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int kari1 = 0; kari1 0 int kari2 = 0; kari2 0 int kari3 = 0; kari3 0 for(int i = 0; i < N ; i++){
			kari1 = scanner.nextInt();
			kari2 = scanner.nextInt();
			kari3 = amida[kari1-1];
			amida[kari1-1] = amida[kari2-1];
			amida[kari2-1] = kari3;
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			kari1 = scanner.nextInt();
			kari2 = scanner.nextInt();
			kari3 = amida[kari1-1];
			amida[kari1-1] = amida[kari2-1];
			amida[kari2-1] = kari3;
		} {
			kari1 = scanner.nextInt();
			kari2 = scanner.nextInt();
			kari3 = amida[kari1-1];
			amida[kari1-1] = amida[kari2-1];
			amida[kari2-1] = kari3;
		} kari1 = scanner.nextInt() kari1 scanner.nextInt() scanner.nextInt scanner kari2 = scanner.nextInt() kari2 scanner.nextInt() scanner.nextInt scanner kari3 = amida[kari1-1] kari3 amida[kari1-1] amida kari1-1 kari1 1 amida[kari1-1] = amida[kari2-1] amida[kari1-1] amida kari1-1 kari1 1 amida[kari2-1] amida kari2-1 kari2 1 amida[kari2-1] = kari3 amida[kari2-1] amida kari2-1 kari2 1 kari3 for(int i = 0; i < W ; i++){
			System.out.println(amida[i]);
		} int i = 0; int i = 0; i 0 i < W i W i++ i++ i {
			System.out.println(amida[i]);
		} {
			System.out.println(amida[i]);
		} System.out.println(amida[i]) System.out.println System.out System System.out amida[i] amida i scanner.close() scanner.close scanner return ; public static int[] Amida(int W) {
		int[] amida = new int[W];
		for(int i = 0; i < W ; i++){
			amida[i] = i+1;
		}
		return amida;
	} Amida {
		int[] amida = new int[W];
		for(int i = 0; i < W ; i++){
			amida[i] = i+1;
		}
		return amida;
	} int[] amida = new int[W]; amida new int[W] W for(int i = 0; i < W ; i++){
			amida[i] = i+1;
		} int i = 0; int i = 0; i 0 i < W i W i++ i++ i {
			amida[i] = i+1;
		} {
			amida[i] = i+1;
		} amida[i] = i+1 amida[i] amida i i+1 i 1 return amida; amida int W W public class Main{

	public static void main(String[] args) {
		scan();
		
	}
	//??\????°???¨??¢??°
	public static void scan() {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("\\s*,\\s*|\n");
		int W = scanner.nextInt();
		int[] amida = Amida(W);
		int N = scanner.nextInt();
		int kari1 = 0;
		int kari2 = 0;
		int kari3 = 0;
		for(int i = 0; i < N ; i++){
			kari1 = scanner.nextInt();
			kari2 = scanner.nextInt();
			kari3 = amida[kari1-1];
			amida[kari1-1] = amida[kari2-1];
			amida[kari2-1] = kari3;
		}
		for(int i = 0; i < W ; i++){
			System.out.println(amida[i]);
		}
		scanner.close();
		return ;
	}
	
	public static int[] Amida(int W) {
		int[] amida = new int[W];
		for(int i = 0; i < W ; i++){
			amida[i] = i+1;
		}
		return amida;
	}
	
	
} public class Main{

	public static void main(String[] args) {
		scan();
		
	}
	//??\????°???¨??¢??°
	public static void scan() {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("\\s*,\\s*|\n");
		int W = scanner.nextInt();
		int[] amida = Amida(W);
		int N = scanner.nextInt();
		int kari1 = 0;
		int kari2 = 0;
		int kari3 = 0;
		for(int i = 0; i < N ; i++){
			kari1 = scanner.nextInt();
			kari2 = scanner.nextInt();
			kari3 = amida[kari1-1];
			amida[kari1-1] = amida[kari2-1];
			amida[kari2-1] = kari3;
		}
		for(int i = 0; i < W ; i++){
			System.out.println(amida[i]);
		}
		scanner.close();
		return ;
	}
	
	public static int[] Amida(int W) {
		int[] amida = new int[W];
		for(int i = 0; i < W ; i++){
			amida[i] = i+1;
		}
		return amida;
	}
	
	
} Main
import java.util.*;

public class Main{

	public static void main(String[] args) {
		scan();
		
	}
	//??\????°???¨??¢??°
	public static void scan() {
		Scanner scanner = new Scanner(System.in);
		scanner.useDelimiter("\\s*,\\s*|\n");
		int W = scanner.nextInt();
		int[] amida = Amida(W);
		int N = scanner.nextInt();
		int kari1 = 0;
		int kari2 = 0;
		int kari3 = 0;
		for(int i = 0; i < N ; i++){
			kari1 = scanner.nextInt();
			kari2 = scanner.nextInt();
			kari3 = amida[kari1-1];
			amida[kari1-1] = amida[kari2-1];
			amida[kari2-1] = kari3;
		}
		for(int i = 0; i < W ; i++){
			System.out.println(amida[i]);
		}
		scanner.close();
		return ;
	}
	
	public static int[] Amida(int W) {
		int[] amida = new int[W];
		for(int i = 0; i < W ; i++){
			amida[i] = i+1;
		}
		return amida;
	}
	
	
}