import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		int w;
		int n;
		
		//データ入力の準備
		Scanner sc = new Scanner(System.in);
		
		//あみだくじのサイズを入力
		w = sc.nextInt();
		n = sc.nextInt();
		
		//データ格納用配列の追加
		int[] data = new int[w];
		for (int i = 0; i < w; i++){
			data[i] = i + 1;
		}
		
		//あみだくじのswap
		for (int i = 0; i < n; i++){
			String str = sc.next();
			String ab[] = str.split(",");
			
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			
			swap(data,a,b);
		}
		
		//結果の出力
		for (int i = 0; i < w; i++){
			System.out.println(data[i]);
		}
	}
	
	private static void swap(int[] data, int a, int b){
		int temp = data[a];
		data[a] = data[b];
		data[b] = temp;
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		int w;
		int n;
		
		//データ入力の準備
		Scanner sc = new Scanner(System.in);
		
		//あみだくじのサイズを入力
		w = sc.nextInt();
		n = sc.nextInt();
		
		//データ格納用配列の追加
		int[] data = new int[w];
		for (int i = 0; i < w; i++){
			data[i] = i + 1;
		}
		
		//あみだくじのswap
		for (int i = 0; i < n; i++){
			String str = sc.next();
			String ab[] = str.split(",");
			
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			
			swap(data,a,b);
		}
		
		//結果の出力
		for (int i = 0; i < w; i++){
			System.out.println(data[i]);
		}
	}
	
	private static void swap(int[] data, int a, int b){
		int temp = data[a];
		data[a] = data[b];
		data[b] = temp;
	}
} Main public static void main(String[] args){
		int w;
		int n;
		
		//データ入力の準備
		Scanner sc = new Scanner(System.in);
		
		//あみだくじのサイズを入力
		w = sc.nextInt();
		n = sc.nextInt();
		
		//データ格納用配列の追加
		int[] data = new int[w];
		for (int i = 0; i < w; i++){
			data[i] = i + 1;
		}
		
		//あみだくじのswap
		for (int i = 0; i < n; i++){
			String str = sc.next();
			String ab[] = str.split(",");
			
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			
			swap(data,a,b);
		}
		
		//結果の出力
		for (int i = 0; i < w; i++){
			System.out.println(data[i]);
		}
	} main {
		int w;
		int n;
		
		//データ入力の準備
		Scanner sc = new Scanner(System.in);
		
		//あみだくじのサイズを入力
		w = sc.nextInt();
		n = sc.nextInt();
		
		//データ格納用配列の追加
		int[] data = new int[w];
		for (int i = 0; i < w; i++){
			data[i] = i + 1;
		}
		
		//あみだくじのswap
		for (int i = 0; i < n; i++){
			String str = sc.next();
			String ab[] = str.split(",");
			
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			
			swap(data,a,b);
		}
		
		//結果の出力
		for (int i = 0; i < w; i++){
			System.out.println(data[i]);
		}
	} int w; w int n; n Scanner sc = new Scanner(System.in); sc new Scanner(System.in) w = sc.nextInt() w sc.nextInt() sc.nextInt sc n = sc.nextInt() n sc.nextInt() sc.nextInt sc int[] data = new int[w]; data new int[w] w for (int i = 0; i < w; i++){
			data[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			data[i] = i + 1;
		} {
			data[i] = i + 1;
		} data[i] = i + 1 data[i] data i i + 1 i 1 for (int i = 0; i < n; i++){
			String str = sc.next();
			String ab[] = str.split(",");
			
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			
			swap(data,a,b);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String str = sc.next();
			String ab[] = str.split(",");
			
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			
			swap(data,a,b);
		} {
			String str = sc.next();
			String ab[] = str.split(",");
			
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			
			swap(data,a,b);
		} String str = sc.next(); str sc.next() sc.next sc String ab[] = str.split(","); ab str.split(",") str.split str "," int a = Integer.parseInt(ab[0]) - 1; a Integer.parseInt(ab[0]) - 1 Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 1 int b = Integer.parseInt(ab[1]) - 1; b Integer.parseInt(ab[1]) - 1 Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 1 swap(data,a,b) swap data a b for (int i = 0; i < w; i++){
			System.out.println(data[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(data[i]);
		} {
			System.out.println(data[i]);
		} System.out.println(data[i]) System.out.println System.out System System.out data[i] data i String[] args args private static void swap(int[] data, int a, int b){
		int temp = data[a];
		data[a] = data[b];
		data[b] = temp;
	} swap {
		int temp = data[a];
		data[a] = data[b];
		data[b] = temp;
	} int temp = data[a]; temp data[a] data a data[a] = data[b] data[a] data a data[b] data b data[b] = temp data[b] data b temp int[] data data int a a int b b public class Main{
	public static void main(String[] args){
		int w;
		int n;
		
		//データ入力の準備
		Scanner sc = new Scanner(System.in);
		
		//あみだくじのサイズを入力
		w = sc.nextInt();
		n = sc.nextInt();
		
		//データ格納用配列の追加
		int[] data = new int[w];
		for (int i = 0; i < w; i++){
			data[i] = i + 1;
		}
		
		//あみだくじのswap
		for (int i = 0; i < n; i++){
			String str = sc.next();
			String ab[] = str.split(",");
			
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			
			swap(data,a,b);
		}
		
		//結果の出力
		for (int i = 0; i < w; i++){
			System.out.println(data[i]);
		}
	}
	
	private static void swap(int[] data, int a, int b){
		int temp = data[a];
		data[a] = data[b];
		data[b] = temp;
	}
} public class Main{
	public static void main(String[] args){
		int w;
		int n;
		
		//データ入力の準備
		Scanner sc = new Scanner(System.in);
		
		//あみだくじのサイズを入力
		w = sc.nextInt();
		n = sc.nextInt();
		
		//データ格納用配列の追加
		int[] data = new int[w];
		for (int i = 0; i < w; i++){
			data[i] = i + 1;
		}
		
		//あみだくじのswap
		for (int i = 0; i < n; i++){
			String str = sc.next();
			String ab[] = str.split(",");
			
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			
			swap(data,a,b);
		}
		
		//結果の出力
		for (int i = 0; i < w; i++){
			System.out.println(data[i]);
		}
	}
	
	private static void swap(int[] data, int a, int b){
		int temp = data[a];
		data[a] = data[b];
		data[b] = temp;
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		int w;
		int n;
		
		//データ入力の準備
		Scanner sc = new Scanner(System.in);
		
		//あみだくじのサイズを入力
		w = sc.nextInt();
		n = sc.nextInt();
		
		//データ格納用配列の追加
		int[] data = new int[w];
		for (int i = 0; i < w; i++){
			data[i] = i + 1;
		}
		
		//あみだくじのswap
		for (int i = 0; i < n; i++){
			String str = sc.next();
			String ab[] = str.split(",");
			
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			
			swap(data,a,b);
		}
		
		//結果の出力
		for (int i = 0; i < w; i++){
			System.out.println(data[i]);
		}
	}
	
	private static void swap(int[] data, int a, int b){
		int temp = data[a];
		data[a] = data[b];
		data[b] = temp;
	}
}
