import java.util.Scanner;
import java.math.*;
import java.text.*;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		in.useDelimiter("[\\s*[,\\n]\\s*]");
		int[] ls = new int[w];
		for(int i=0; i<w; i++)
			ls[i] = i+1;
		for(int iter=0; iter<n; iter++){
			int a, b;
			a = in.nextInt();
			b = in.nextInt();
			int tmp = ls[a-1];
			ls[a-1] = ls[b-1];
			ls[b-1] = tmp;
		}
		for(int iter=0; iter<w; iter++)
			System.out.println(ls[iter]);
	}

} import java.util.Scanner; Scanner java.util import java.math.*; math.* java import java.text.*; text.* java public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		in.useDelimiter("[\\s*[,\\n]\\s*]");
		int[] ls = new int[w];
		for(int i=0; i<w; i++)
			ls[i] = i+1;
		for(int iter=0; iter<n; iter++){
			int a, b;
			a = in.nextInt();
			b = in.nextInt();
			int tmp = ls[a-1];
			ls[a-1] = ls[b-1];
			ls[b-1] = tmp;
		}
		for(int iter=0; iter<w; iter++)
			System.out.println(ls[iter]);
	}

} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		in.useDelimiter("[\\s*[,\\n]\\s*]");
		int[] ls = new int[w];
		for(int i=0; i<w; i++)
			ls[i] = i+1;
		for(int iter=0; iter<n; iter++){
			int a, b;
			a = in.nextInt();
			b = in.nextInt();
			int tmp = ls[a-1];
			ls[a-1] = ls[b-1];
			ls[b-1] = tmp;
		}
		for(int iter=0; iter<w; iter++)
			System.out.println(ls[iter]);
	} main {
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		in.useDelimiter("[\\s*[,\\n]\\s*]");
		int[] ls = new int[w];
		for(int i=0; i<w; i++)
			ls[i] = i+1;
		for(int iter=0; iter<n; iter++){
			int a, b;
			a = in.nextInt();
			b = in.nextInt();
			int tmp = ls[a-1];
			ls[a-1] = ls[b-1];
			ls[b-1] = tmp;
		}
		for(int iter=0; iter<w; iter++)
			System.out.println(ls[iter]);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int w = in.nextInt(); w in.nextInt() in.nextInt in int n = in.nextInt(); n in.nextInt() in.nextInt in in.useDelimiter("[\\s*[,\\n]\\s*]") in.useDelimiter in "[\\s*[,\\n]\\s*]" int[] ls = new int[w]; ls new int[w] w for(int i=0; i<w; i++)
			ls[i] = i+1; int i=0; int i=0; i 0 i<w i w i++ i++ i ls[i] = i+1; ls[i] = i+1 ls[i] ls i i+1 i 1 for(int iter=0; iter<n; iter++){
			int a, b;
			a = in.nextInt();
			b = in.nextInt();
			int tmp = ls[a-1];
			ls[a-1] = ls[b-1];
			ls[b-1] = tmp;
		} int iter=0; int iter=0; iter 0 iter<n iter n iter++ iter++ iter {
			int a, b;
			a = in.nextInt();
			b = in.nextInt();
			int tmp = ls[a-1];
			ls[a-1] = ls[b-1];
			ls[b-1] = tmp;
		} {
			int a, b;
			a = in.nextInt();
			b = in.nextInt();
			int tmp = ls[a-1];
			ls[a-1] = ls[b-1];
			ls[b-1] = tmp;
		} int a a b; b a = in.nextInt() a in.nextInt() in.nextInt in b = in.nextInt() b in.nextInt() in.nextInt in int tmp = ls[a-1]; tmp ls[a-1] ls a-1 a 1 ls[a-1] = ls[b-1] ls[a-1] ls a-1 a 1 ls[b-1] ls b-1 b 1 ls[b-1] = tmp ls[b-1] ls b-1 b 1 tmp for(int iter=0; iter<w; iter++)
			System.out.println(ls[iter]); int iter=0; int iter=0; iter 0 iter<w iter w iter++ iter++ iter System.out.println(ls[iter]); System.out.println(ls[iter]) System.out.println System.out System System.out ls[iter] ls iter String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		in.useDelimiter("[\\s*[,\\n]\\s*]");
		int[] ls = new int[w];
		for(int i=0; i<w; i++)
			ls[i] = i+1;
		for(int iter=0; iter<n; iter++){
			int a, b;
			a = in.nextInt();
			b = in.nextInt();
			int tmp = ls[a-1];
			ls[a-1] = ls[b-1];
			ls[b-1] = tmp;
		}
		for(int iter=0; iter<w; iter++)
			System.out.println(ls[iter]);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		in.useDelimiter("[\\s*[,\\n]\\s*]");
		int[] ls = new int[w];
		for(int i=0; i<w; i++)
			ls[i] = i+1;
		for(int iter=0; iter<n; iter++){
			int a, b;
			a = in.nextInt();
			b = in.nextInt();
			int tmp = ls[a-1];
			ls[a-1] = ls[b-1];
			ls[b-1] = tmp;
		}
		for(int iter=0; iter<w; iter++)
			System.out.println(ls[iter]);
	}

} Main
import java.util.Scanner;
import java.math.*;
import java.text.*;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int n = in.nextInt();
		in.useDelimiter("[\\s*[,\\n]\\s*]");
		int[] ls = new int[w];
		for(int i=0; i<w; i++)
			ls[i] = i+1;
		for(int iter=0; iter<n; iter++){
			int a, b;
			a = in.nextInt();
			b = in.nextInt();
			int tmp = ls[a-1];
			ls[a-1] = ls[b-1];
			ls[b-1] = tmp;
		}
		for(int iter=0; iter<w; iter++)
			System.out.println(ls[iter]);
	}

}