import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w, n, a, b, tmp;
		String[] s;
		int[] table;
		while(sc.hasNext()){
			w = sc.nextInt();
			table = new int[w + 1];
			for(int i = 0; i <= w; i++){
				table[i] = i;
			}
			n = sc.nextInt();
			for(int i = 0; i < n; i++){
				s = sc.next().split(",");
				a = Integer.parseInt(s[0]);
				b = Integer.parseInt(s[1]);
				tmp = table[a];
				table[a] = table[b];
				table[b] = tmp;
			}
			
			for(int i = 1; i <= w; i++){ 
				System.out.println(table[i]);
			}
		}
	}
} import java.util.*; util.* java class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w, n, a, b, tmp;
		String[] s;
		int[] table;
		while(sc.hasNext()){
			w = sc.nextInt();
			table = new int[w + 1];
			for(int i = 0; i <= w; i++){
				table[i] = i;
			}
			n = sc.nextInt();
			for(int i = 0; i < n; i++){
				s = sc.next().split(",");
				a = Integer.parseInt(s[0]);
				b = Integer.parseInt(s[1]);
				tmp = table[a];
				table[a] = table[b];
				table[b] = tmp;
			}
			
			for(int i = 1; i <= w; i++){ 
				System.out.println(table[i]);
			}
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w, n, a, b, tmp;
		String[] s;
		int[] table;
		while(sc.hasNext()){
			w = sc.nextInt();
			table = new int[w + 1];
			for(int i = 0; i <= w; i++){
				table[i] = i;
			}
			n = sc.nextInt();
			for(int i = 0; i < n; i++){
				s = sc.next().split(",");
				a = Integer.parseInt(s[0]);
				b = Integer.parseInt(s[1]);
				tmp = table[a];
				table[a] = table[b];
				table[b] = tmp;
			}
			
			for(int i = 1; i <= w; i++){ 
				System.out.println(table[i]);
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int w, n, a, b, tmp;
		String[] s;
		int[] table;
		while(sc.hasNext()){
			w = sc.nextInt();
			table = new int[w + 1];
			for(int i = 0; i <= w; i++){
				table[i] = i;
			}
			n = sc.nextInt();
			for(int i = 0; i < n; i++){
				s = sc.next().split(",");
				a = Integer.parseInt(s[0]);
				b = Integer.parseInt(s[1]);
				tmp = table[a];
				table[a] = table[b];
				table[b] = tmp;
			}
			
			for(int i = 1; i <= w; i++){ 
				System.out.println(table[i]);
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w w n n a a b b tmp; tmp String[] s; s int[] table; table while(sc.hasNext()){
			w = sc.nextInt();
			table = new int[w + 1];
			for(int i = 0; i <= w; i++){
				table[i] = i;
			}
			n = sc.nextInt();
			for(int i = 0; i < n; i++){
				s = sc.next().split(",");
				a = Integer.parseInt(s[0]);
				b = Integer.parseInt(s[1]);
				tmp = table[a];
				table[a] = table[b];
				table[b] = tmp;
			}
			
			for(int i = 1; i <= w; i++){ 
				System.out.println(table[i]);
			}
		} sc.hasNext() sc.hasNext sc {
			w = sc.nextInt();
			table = new int[w + 1];
			for(int i = 0; i <= w; i++){
				table[i] = i;
			}
			n = sc.nextInt();
			for(int i = 0; i < n; i++){
				s = sc.next().split(",");
				a = Integer.parseInt(s[0]);
				b = Integer.parseInt(s[1]);
				tmp = table[a];
				table[a] = table[b];
				table[b] = tmp;
			}
			
			for(int i = 1; i <= w; i++){ 
				System.out.println(table[i]);
			}
		} w = sc.nextInt() w sc.nextInt() sc.nextInt sc table = new int[w + 1] table new int[w + 1] w + 1 w 1 for(int i = 0; i <= w; i++){
				table[i] = i;
			} int i = 0; int i = 0; i 0 i <= w i w i++ i++ i {
				table[i] = i;
			} {
				table[i] = i;
			} table[i] = i table[i] table i i n = sc.nextInt() n sc.nextInt() sc.nextInt sc for(int i = 0; i < n; i++){
				s = sc.next().split(",");
				a = Integer.parseInt(s[0]);
				b = Integer.parseInt(s[1]);
				tmp = table[a];
				table[a] = table[b];
				table[b] = tmp;
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				s = sc.next().split(",");
				a = Integer.parseInt(s[0]);
				b = Integer.parseInt(s[1]);
				tmp = table[a];
				table[a] = table[b];
				table[b] = tmp;
			} {
				s = sc.next().split(",");
				a = Integer.parseInt(s[0]);
				b = Integer.parseInt(s[1]);
				tmp = table[a];
				table[a] = table[b];
				table[b] = tmp;
			} s = sc.next().split(",") s sc.next().split(",") sc.next().split sc.next() sc.next sc "," a = Integer.parseInt(s[0]) a Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 b = Integer.parseInt(s[1]) b Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 tmp = table[a] tmp table[a] table a table[a] = table[b] table[a] table a table[b] table b table[b] = tmp table[b] table b tmp for(int i = 1; i <= w; i++){ 
				System.out.println(table[i]);
			} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i { 
				System.out.println(table[i]);
			} { 
				System.out.println(table[i]);
			} System.out.println(table[i]) System.out.println System.out System System.out table[i] table i String[] args args
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w, n, a, b, tmp;
		String[] s;
		int[] table;
		while(sc.hasNext()){
			w = sc.nextInt();
			table = new int[w + 1];
			for(int i = 0; i <= w; i++){
				table[i] = i;
			}
			n = sc.nextInt();
			for(int i = 0; i < n; i++){
				s = sc.next().split(",");
				a = Integer.parseInt(s[0]);
				b = Integer.parseInt(s[1]);
				tmp = table[a];
				table[a] = table[b];
				table[b] = tmp;
			}
			
			for(int i = 1; i <= w; i++){ 
				System.out.println(table[i]);
			}
		}
	}
}