import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int w = Integer.parseInt(str);
		str = br.readLine();
		int n = Integer.parseInt(str);

		int array[] = new int[w];

		for(int i=0; i<w; i++){
			array[i] = i+1;
		}

		for(int i=0; i<n; i++){
			str = br.readLine();
			int a = Integer.parseInt(str.substring(0, str.indexOf(",")));
			int b = Integer.parseInt(str.substring(str.indexOf(",")+1, str.length()));

			swap(array,a-1,b-1);

		}

		for(int i=0; i<array.length; i++){
			System.out.println(array[i]);
		}

	}


	static int[] swap(int[] list,int a, int b){
		int temp = list[a];
		list[a] = list[b];
		list[b] = temp;

		return list;
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int w = Integer.parseInt(str);
		str = br.readLine();
		int n = Integer.parseInt(str);

		int array[] = new int[w];

		for(int i=0; i<w; i++){
			array[i] = i+1;
		}

		for(int i=0; i<n; i++){
			str = br.readLine();
			int a = Integer.parseInt(str.substring(0, str.indexOf(",")));
			int b = Integer.parseInt(str.substring(str.indexOf(",")+1, str.length()));

			swap(array,a-1,b-1);

		}

		for(int i=0; i<array.length; i++){
			System.out.println(array[i]);
		}

	}


	static int[] swap(int[] list,int a, int b){
		int temp = list[a];
		list[a] = list[b];
		list[b] = temp;

		return list;
	}

} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int w = Integer.parseInt(str);
		str = br.readLine();
		int n = Integer.parseInt(str);

		int array[] = new int[w];

		for(int i=0; i<w; i++){
			array[i] = i+1;
		}

		for(int i=0; i<n; i++){
			str = br.readLine();
			int a = Integer.parseInt(str.substring(0, str.indexOf(",")));
			int b = Integer.parseInt(str.substring(str.indexOf(",")+1, str.length()));

			swap(array,a-1,b-1);

		}

		for(int i=0; i<array.length; i++){
			System.out.println(array[i]);
		}

	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int w = Integer.parseInt(str);
		str = br.readLine();
		int n = Integer.parseInt(str);

		int array[] = new int[w];

		for(int i=0; i<w; i++){
			array[i] = i+1;
		}

		for(int i=0; i<n; i++){
			str = br.readLine();
			int a = Integer.parseInt(str.substring(0, str.indexOf(",")));
			int b = Integer.parseInt(str.substring(str.indexOf(",")+1, str.length()));

			swap(array,a-1,b-1);

		}

		for(int i=0; i<array.length; i++){
			System.out.println(array[i]);
		}

	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str; str str = br.readLine() str br.readLine() br.readLine br int w = Integer.parseInt(str); w Integer.parseInt(str) Integer.parseInt Integer str str = br.readLine() str br.readLine() br.readLine br int n = Integer.parseInt(str); n Integer.parseInt(str) Integer.parseInt Integer str int array[] = new int[w]; array new int[w] w for(int i=0; i<w; i++){
			array[i] = i+1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			array[i] = i+1;
		} {
			array[i] = i+1;
		} array[i] = i+1 array[i] array i i+1 i 1 for(int i=0; i<n; i++){
			str = br.readLine();
			int a = Integer.parseInt(str.substring(0, str.indexOf(",")));
			int b = Integer.parseInt(str.substring(str.indexOf(",")+1, str.length()));

			swap(array,a-1,b-1);

		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			str = br.readLine();
			int a = Integer.parseInt(str.substring(0, str.indexOf(",")));
			int b = Integer.parseInt(str.substring(str.indexOf(",")+1, str.length()));

			swap(array,a-1,b-1);

		} {
			str = br.readLine();
			int a = Integer.parseInt(str.substring(0, str.indexOf(",")));
			int b = Integer.parseInt(str.substring(str.indexOf(",")+1, str.length()));

			swap(array,a-1,b-1);

		} str = br.readLine() str br.readLine() br.readLine br int a = Integer.parseInt(str.substring(0, str.indexOf(","))); a Integer.parseInt(str.substring(0, str.indexOf(","))) Integer.parseInt Integer str.substring(0, str.indexOf(",")) str.substring str 0 str.indexOf(",") str.indexOf str "," int b = Integer.parseInt(str.substring(str.indexOf(",")+1, str.length())); b Integer.parseInt(str.substring(str.indexOf(",")+1, str.length())) Integer.parseInt Integer str.substring(str.indexOf(",")+1, str.length()) str.substring str str.indexOf(",")+1 str.indexOf(",") str.indexOf str "," 1 str.length() str.length str swap(array,a-1,b-1) swap array a-1 a 1 b-1 b 1 for(int i=0; i<array.length; i++){
			System.out.println(array[i]);
		} int i=0; int i=0; i 0 i<array.length i array.length array array.length i++ i++ i {
			System.out.println(array[i]);
		} {
			System.out.println(array[i]);
		} System.out.println(array[i]) System.out.println System.out System System.out array[i] array i String[] args args static int[] swap(int[] list,int a, int b){
		int temp = list[a];
		list[a] = list[b];
		list[b] = temp;

		return list;
	} swap {
		int temp = list[a];
		list[a] = list[b];
		list[b] = temp;

		return list;
	} int temp = list[a]; temp list[a] list a list[a] = list[b] list[a] list a list[b] list b list[b] = temp list[b] list b temp return list; list int[] list list int a a int b b public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int w = Integer.parseInt(str);
		str = br.readLine();
		int n = Integer.parseInt(str);

		int array[] = new int[w];

		for(int i=0; i<w; i++){
			array[i] = i+1;
		}

		for(int i=0; i<n; i++){
			str = br.readLine();
			int a = Integer.parseInt(str.substring(0, str.indexOf(",")));
			int b = Integer.parseInt(str.substring(str.indexOf(",")+1, str.length()));

			swap(array,a-1,b-1);

		}

		for(int i=0; i<array.length; i++){
			System.out.println(array[i]);
		}

	}


	static int[] swap(int[] list,int a, int b){
		int temp = list[a];
		list[a] = list[b];
		list[b] = temp;

		return list;
	}

} public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int w = Integer.parseInt(str);
		str = br.readLine();
		int n = Integer.parseInt(str);

		int array[] = new int[w];

		for(int i=0; i<w; i++){
			array[i] = i+1;
		}

		for(int i=0; i<n; i++){
			str = br.readLine();
			int a = Integer.parseInt(str.substring(0, str.indexOf(",")));
			int b = Integer.parseInt(str.substring(str.indexOf(",")+1, str.length()));

			swap(array,a-1,b-1);

		}

		for(int i=0; i<array.length; i++){
			System.out.println(array[i]);
		}

	}


	static int[] swap(int[] list,int a, int b){
		int temp = list[a];
		list[a] = list[b];
		list[b] = temp;

		return list;
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int w = Integer.parseInt(str);
		str = br.readLine();
		int n = Integer.parseInt(str);

		int array[] = new int[w];

		for(int i=0; i<w; i++){
			array[i] = i+1;
		}

		for(int i=0; i<n; i++){
			str = br.readLine();
			int a = Integer.parseInt(str.substring(0, str.indexOf(",")));
			int b = Integer.parseInt(str.substring(str.indexOf(",")+1, str.length()));

			swap(array,a-1,b-1);

		}

		for(int i=0; i<array.length; i++){
			System.out.println(array[i]);
		}

	}


	static int[] swap(int[] list,int a, int b){
		int temp = list[a];
		list[a] = list[b];
		list[b] = temp;

		return list;
	}

}