import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] k = new int[w];
		for(int i = 0; i < w; i++){
			k[i] = i+1;
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String s = sc.next();
			int h = 0;
			for(h = 0; h < s.length(); h++){
				if(s.charAt(h) == ','){
					break;
				}
			}
			int a = Integer.parseInt(s.substring(0,h));
			int b = Integer.parseInt(s.substring(h+1,s.length()));
			//swap(k[a-1], k[b-1]);
			int c = k[a-1];
			k[a-1] = k[b-1];
			k[b-1] = c;
		}
		for(int i = 0; i < w; i++){
			System.out.println(k[i]);
		}
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] k = new int[w];
		for(int i = 0; i < w; i++){
			k[i] = i+1;
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String s = sc.next();
			int h = 0;
			for(h = 0; h < s.length(); h++){
				if(s.charAt(h) == ','){
					break;
				}
			}
			int a = Integer.parseInt(s.substring(0,h));
			int b = Integer.parseInt(s.substring(h+1,s.length()));
			//swap(k[a-1], k[b-1]);
			int c = k[a-1];
			k[a-1] = k[b-1];
			k[b-1] = c;
		}
		for(int i = 0; i < w; i++){
			System.out.println(k[i]);
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] k = new int[w];
		for(int i = 0; i < w; i++){
			k[i] = i+1;
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String s = sc.next();
			int h = 0;
			for(h = 0; h < s.length(); h++){
				if(s.charAt(h) == ','){
					break;
				}
			}
			int a = Integer.parseInt(s.substring(0,h));
			int b = Integer.parseInt(s.substring(h+1,s.length()));
			//swap(k[a-1], k[b-1]);
			int c = k[a-1];
			k[a-1] = k[b-1];
			k[b-1] = c;
		}
		for(int i = 0; i < w; i++){
			System.out.println(k[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] k = new int[w];
		for(int i = 0; i < w; i++){
			k[i] = i+1;
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String s = sc.next();
			int h = 0;
			for(h = 0; h < s.length(); h++){
				if(s.charAt(h) == ','){
					break;
				}
			}
			int a = Integer.parseInt(s.substring(0,h));
			int b = Integer.parseInt(s.substring(h+1,s.length()));
			//swap(k[a-1], k[b-1]);
			int c = k[a-1];
			k[a-1] = k[b-1];
			k[b-1] = c;
		}
		for(int i = 0; i < w; i++){
			System.out.println(k[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int[] k = new int[w]; k new int[w] w for(int i = 0; i < w; i++){
			k[i] = i+1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			k[i] = i+1;
		} {
			k[i] = i+1;
		} k[i] = i+1 k[i] k i i+1 i 1 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i = 0; i < n; i++){
			String s = sc.next();
			int h = 0;
			for(h = 0; h < s.length(); h++){
				if(s.charAt(h) == ','){
					break;
				}
			}
			int a = Integer.parseInt(s.substring(0,h));
			int b = Integer.parseInt(s.substring(h+1,s.length()));
			//swap(k[a-1], k[b-1]);
			int c = k[a-1];
			k[a-1] = k[b-1];
			k[b-1] = c;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String s = sc.next();
			int h = 0;
			for(h = 0; h < s.length(); h++){
				if(s.charAt(h) == ','){
					break;
				}
			}
			int a = Integer.parseInt(s.substring(0,h));
			int b = Integer.parseInt(s.substring(h+1,s.length()));
			//swap(k[a-1], k[b-1]);
			int c = k[a-1];
			k[a-1] = k[b-1];
			k[b-1] = c;
		} {
			String s = sc.next();
			int h = 0;
			for(h = 0; h < s.length(); h++){
				if(s.charAt(h) == ','){
					break;
				}
			}
			int a = Integer.parseInt(s.substring(0,h));
			int b = Integer.parseInt(s.substring(h+1,s.length()));
			//swap(k[a-1], k[b-1]);
			int c = k[a-1];
			k[a-1] = k[b-1];
			k[b-1] = c;
		} String s = sc.next(); s sc.next() sc.next sc int h = 0; h 0 for(h = 0; h < s.length(); h++){
				if(s.charAt(h) == ','){
					break;
				}
			} h = 0; h = 0 h 0 h < s.length() h s.length() s.length s h++ h++ h {
				if(s.charAt(h) == ','){
					break;
				}
			} {
				if(s.charAt(h) == ','){
					break;
				}
			} if(s.charAt(h) == ','){
					break;
				} s.charAt(h) == ',' s.charAt(h) s.charAt s h ',' {
					break;
				} break; int a = Integer.parseInt(s.substring(0,h)); a Integer.parseInt(s.substring(0,h)) Integer.parseInt Integer s.substring(0,h) s.substring s 0 h int b = Integer.parseInt(s.substring(h+1,s.length())); b Integer.parseInt(s.substring(h+1,s.length())) Integer.parseInt Integer s.substring(h+1,s.length()) s.substring s h+1 h 1 s.length() s.length s int c = k[a-1]; c k[a-1] k a-1 a 1 k[a-1] = k[b-1] k[a-1] k a-1 a 1 k[b-1] k b-1 b 1 k[b-1] = c k[b-1] k b-1 b 1 c for(int i = 0; i < w; i++){
			System.out.println(k[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(k[i]);
		} {
			System.out.println(k[i]);
		} System.out.println(k[i]) System.out.println System.out System System.out k[i] k i String[] args args public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] k = new int[w];
		for(int i = 0; i < w; i++){
			k[i] = i+1;
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String s = sc.next();
			int h = 0;
			for(h = 0; h < s.length(); h++){
				if(s.charAt(h) == ','){
					break;
				}
			}
			int a = Integer.parseInt(s.substring(0,h));
			int b = Integer.parseInt(s.substring(h+1,s.length()));
			//swap(k[a-1], k[b-1]);
			int c = k[a-1];
			k[a-1] = k[b-1];
			k[b-1] = c;
		}
		for(int i = 0; i < w; i++){
			System.out.println(k[i]);
		}
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] k = new int[w];
		for(int i = 0; i < w; i++){
			k[i] = i+1;
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String s = sc.next();
			int h = 0;
			for(h = 0; h < s.length(); h++){
				if(s.charAt(h) == ','){
					break;
				}
			}
			int a = Integer.parseInt(s.substring(0,h));
			int b = Integer.parseInt(s.substring(h+1,s.length()));
			//swap(k[a-1], k[b-1]);
			int c = k[a-1];
			k[a-1] = k[b-1];
			k[b-1] = c;
		}
		for(int i = 0; i < w; i++){
			System.out.println(k[i]);
		}
	}
} Main
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] k = new int[w];
		for(int i = 0; i < w; i++){
			k[i] = i+1;
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			String s = sc.next();
			int h = 0;
			for(h = 0; h < s.length(); h++){
				if(s.charAt(h) == ','){
					break;
				}
			}
			int a = Integer.parseInt(s.substring(0,h));
			int b = Integer.parseInt(s.substring(h+1,s.length()));
			//swap(k[a-1], k[b-1]);
			int c = k[a-1];
			k[a-1] = k[b-1];
			k[b-1] = c;
		}
		for(int i = 0; i < w; i++){
			System.out.println(k[i]);
		}
	}
}