import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lines = new int[w+1];
		for(int i =1; i<lines.length; i++){
			lines[i]=i;	//initialize lines[]
		}
		for(int i=0; i<n; i++){
			String s = sc.next();
			int a = Integer.parseInt(s.substring(0, s.indexOf(",")));
			int b = Integer.parseInt(s.substring(s.indexOf(",")+1,s.length()));
			lines = Swap(lines, a, b);
		}
		for(int i=1; i<lines.length; i++){
			System.out.println(lines[i]);
		}

	}
	static int[] Swap(int[] ints, int a, int b){
		int c = ints[a];
		ints[a]= ints[b];
		ints[b]= c;
		return ints;
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lines = new int[w+1];
		for(int i =1; i<lines.length; i++){
			lines[i]=i;	//initialize lines[]
		}
		for(int i=0; i<n; i++){
			String s = sc.next();
			int a = Integer.parseInt(s.substring(0, s.indexOf(",")));
			int b = Integer.parseInt(s.substring(s.indexOf(",")+1,s.length()));
			lines = Swap(lines, a, b);
		}
		for(int i=1; i<lines.length; i++){
			System.out.println(lines[i]);
		}

	}
	static int[] Swap(int[] ints, int a, int b){
		int c = ints[a];
		ints[a]= ints[b];
		ints[b]= c;
		return ints;
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lines = new int[w+1];
		for(int i =1; i<lines.length; i++){
			lines[i]=i;	//initialize lines[]
		}
		for(int i=0; i<n; i++){
			String s = sc.next();
			int a = Integer.parseInt(s.substring(0, s.indexOf(",")));
			int b = Integer.parseInt(s.substring(s.indexOf(",")+1,s.length()));
			lines = Swap(lines, a, b);
		}
		for(int i=1; i<lines.length; i++){
			System.out.println(lines[i]);
		}

	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lines = new int[w+1];
		for(int i =1; i<lines.length; i++){
			lines[i]=i;	//initialize lines[]
		}
		for(int i=0; i<n; i++){
			String s = sc.next();
			int a = Integer.parseInt(s.substring(0, s.indexOf(",")));
			int b = Integer.parseInt(s.substring(s.indexOf(",")+1,s.length()));
			lines = Swap(lines, a, b);
		}
		for(int i=1; i<lines.length; i++){
			System.out.println(lines[i]);
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] lines = new int[w+1]; lines new int[w+1] w+1 w 1 for(int i =1; i<lines.length; i++){
			lines[i]=i;	//initialize lines[]
		} int i =1; int i =1; i 1 i<lines.length i lines.length lines lines.length i++ i++ i {
			lines[i]=i;	//initialize lines[]
		} {
			lines[i]=i;	//initialize lines[]
		} lines[i]=i lines[i] lines i i for(int i=0; i<n; i++){
			String s = sc.next();
			int a = Integer.parseInt(s.substring(0, s.indexOf(",")));
			int b = Integer.parseInt(s.substring(s.indexOf(",")+1,s.length()));
			lines = Swap(lines, a, b);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String s = sc.next();
			int a = Integer.parseInt(s.substring(0, s.indexOf(",")));
			int b = Integer.parseInt(s.substring(s.indexOf(",")+1,s.length()));
			lines = Swap(lines, a, b);
		} {
			String s = sc.next();
			int a = Integer.parseInt(s.substring(0, s.indexOf(",")));
			int b = Integer.parseInt(s.substring(s.indexOf(",")+1,s.length()));
			lines = Swap(lines, a, b);
		} String s = sc.next(); s sc.next() sc.next sc int a = Integer.parseInt(s.substring(0, s.indexOf(","))); a Integer.parseInt(s.substring(0, s.indexOf(","))) Integer.parseInt Integer s.substring(0, s.indexOf(",")) s.substring s 0 s.indexOf(",") s.indexOf s "," int b = Integer.parseInt(s.substring(s.indexOf(",")+1,s.length())); b Integer.parseInt(s.substring(s.indexOf(",")+1,s.length())) Integer.parseInt Integer s.substring(s.indexOf(",")+1,s.length()) s.substring s s.indexOf(",")+1 s.indexOf(",") s.indexOf s "," 1 s.length() s.length s lines = Swap(lines, a, b) lines Swap(lines, a, b) Swap lines a b for(int i=1; i<lines.length; i++){
			System.out.println(lines[i]);
		} int i=1; int i=1; i 1 i<lines.length i lines.length lines lines.length i++ i++ i {
			System.out.println(lines[i]);
		} {
			System.out.println(lines[i]);
		} System.out.println(lines[i]) System.out.println System.out System System.out lines[i] lines i String[] args args static int[] Swap(int[] ints, int a, int b){
		int c = ints[a];
		ints[a]= ints[b];
		ints[b]= c;
		return ints;
	} Swap {
		int c = ints[a];
		ints[a]= ints[b];
		ints[b]= c;
		return ints;
	} int c = ints[a]; c ints[a] ints a ints[a]= ints[b] ints[a] ints a ints[b] ints b ints[b]= c ints[b] ints b c return ints; ints int[] ints ints int a a int b b public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lines = new int[w+1];
		for(int i =1; i<lines.length; i++){
			lines[i]=i;	//initialize lines[]
		}
		for(int i=0; i<n; i++){
			String s = sc.next();
			int a = Integer.parseInt(s.substring(0, s.indexOf(",")));
			int b = Integer.parseInt(s.substring(s.indexOf(",")+1,s.length()));
			lines = Swap(lines, a, b);
		}
		for(int i=1; i<lines.length; i++){
			System.out.println(lines[i]);
		}

	}
	static int[] Swap(int[] ints, int a, int b){
		int c = ints[a];
		ints[a]= ints[b];
		ints[b]= c;
		return ints;
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lines = new int[w+1];
		for(int i =1; i<lines.length; i++){
			lines[i]=i;	//initialize lines[]
		}
		for(int i=0; i<n; i++){
			String s = sc.next();
			int a = Integer.parseInt(s.substring(0, s.indexOf(",")));
			int b = Integer.parseInt(s.substring(s.indexOf(",")+1,s.length()));
			lines = Swap(lines, a, b);
		}
		for(int i=1; i<lines.length; i++){
			System.out.println(lines[i]);
		}

	}
	static int[] Swap(int[] ints, int a, int b){
		int c = ints[a];
		ints[a]= ints[b];
		ints[b]= c;
		return ints;
	}

} Main
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lines = new int[w+1];
		for(int i =1; i<lines.length; i++){
			lines[i]=i;	//initialize lines[]
		}
		for(int i=0; i<n; i++){
			String s = sc.next();
			int a = Integer.parseInt(s.substring(0, s.indexOf(",")));
			int b = Integer.parseInt(s.substring(s.indexOf(",")+1,s.length()));
			lines = Swap(lines, a, b);
		}
		for(int i=1; i<lines.length; i++){
			System.out.println(lines[i]);
		}

	}
	static int[] Swap(int[] ints, int a, int b){
		int c = ints[a];
		ints[a]= ints[b];
		ints[b]= c;
		return ints;
	}

}