import java.util.Scanner;

public class Main {
	public static Scanner sc;
	
	public static void main(String[] args){
		//宣言
		sc = new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int a[]=new int[n+1];
		int b[]=new int[n+1];
		String s[]=new String[n+1];
		int i=0;
		for(i=1;i<=n;i++){
			String str =sc.next();
			String[] ab =str.split(",");
			a[i]= Integer.parseInt(ab[0]);
			b[i]=Integer.parseInt(ab[1]);
		}
		int bar[]=new int[w+1];
		for(i=1;i<=w;i++) {
			bar[i]=i;
		}
		//演算
		for(i=1;i<=n;i++) {
			//swap
			int p =bar[(int)a[i]];
			bar[(int)a[i]]=bar[(int)b[i]];
			bar[(int)b[i]]=p;
			
		}
		//出力
		for(i=1;i<=w;i++) {
			System.out.println(bar[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static Scanner sc;
	
	public static void main(String[] args){
		//宣言
		sc = new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int a[]=new int[n+1];
		int b[]=new int[n+1];
		String s[]=new String[n+1];
		int i=0;
		for(i=1;i<=n;i++){
			String str =sc.next();
			String[] ab =str.split(",");
			a[i]= Integer.parseInt(ab[0]);
			b[i]=Integer.parseInt(ab[1]);
		}
		int bar[]=new int[w+1];
		for(i=1;i<=w;i++) {
			bar[i]=i;
		}
		//演算
		for(i=1;i<=n;i++) {
			//swap
			int p =bar[(int)a[i]];
			bar[(int)a[i]]=bar[(int)b[i]];
			bar[(int)b[i]]=p;
			
		}
		//出力
		for(i=1;i<=w;i++) {
			System.out.println(bar[i]);
		}
	}
} Main public static Scanner sc; sc public static void main(String[] args){
		//宣言
		sc = new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int a[]=new int[n+1];
		int b[]=new int[n+1];
		String s[]=new String[n+1];
		int i=0;
		for(i=1;i<=n;i++){
			String str =sc.next();
			String[] ab =str.split(",");
			a[i]= Integer.parseInt(ab[0]);
			b[i]=Integer.parseInt(ab[1]);
		}
		int bar[]=new int[w+1];
		for(i=1;i<=w;i++) {
			bar[i]=i;
		}
		//演算
		for(i=1;i<=n;i++) {
			//swap
			int p =bar[(int)a[i]];
			bar[(int)a[i]]=bar[(int)b[i]];
			bar[(int)b[i]]=p;
			
		}
		//出力
		for(i=1;i<=w;i++) {
			System.out.println(bar[i]);
		}
	} main {
		//宣言
		sc = new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int a[]=new int[n+1];
		int b[]=new int[n+1];
		String s[]=new String[n+1];
		int i=0;
		for(i=1;i<=n;i++){
			String str =sc.next();
			String[] ab =str.split(",");
			a[i]= Integer.parseInt(ab[0]);
			b[i]=Integer.parseInt(ab[1]);
		}
		int bar[]=new int[w+1];
		for(i=1;i<=w;i++) {
			bar[i]=i;
		}
		//演算
		for(i=1;i<=n;i++) {
			//swap
			int p =bar[(int)a[i]];
			bar[(int)a[i]]=bar[(int)b[i]];
			bar[(int)b[i]]=p;
			
		}
		//出力
		for(i=1;i<=w;i++) {
			System.out.println(bar[i]);
		}
	} 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 a[]=new int[n+1]; a new int[n+1] n+1 n 1 int b[]=new int[n+1]; b new int[n+1] n+1 n 1 String s[]=new String[n+1]; s new String[n+1] n+1 n 1 int i=0; i 0 for(i=1;i<=n;i++){
			String str =sc.next();
			String[] ab =str.split(",");
			a[i]= Integer.parseInt(ab[0]);
			b[i]=Integer.parseInt(ab[1]);
		} i=1; i=1 i 1 i<=n i n i++ i++ i {
			String str =sc.next();
			String[] ab =str.split(",");
			a[i]= Integer.parseInt(ab[0]);
			b[i]=Integer.parseInt(ab[1]);
		} {
			String str =sc.next();
			String[] ab =str.split(",");
			a[i]= Integer.parseInt(ab[0]);
			b[i]=Integer.parseInt(ab[1]);
		} String str =sc.next(); str sc.next() sc.next sc String[] ab =str.split(","); ab str.split(",") str.split str "," a[i]= Integer.parseInt(ab[0]) a[i] a i Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 b[i]=Integer.parseInt(ab[1]) b[i] b i Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 int bar[]=new int[w+1]; bar new int[w+1] w+1 w 1 for(i=1;i<=w;i++) {
			bar[i]=i;
		} i=1; i=1 i 1 i<=w i w i++ i++ i {
			bar[i]=i;
		} {
			bar[i]=i;
		} bar[i]=i bar[i] bar i i for(i=1;i<=n;i++) {
			//swap
			int p =bar[(int)a[i]];
			bar[(int)a[i]]=bar[(int)b[i]];
			bar[(int)b[i]]=p;
			
		} i=1; i=1 i 1 i<=n i n i++ i++ i {
			//swap
			int p =bar[(int)a[i]];
			bar[(int)a[i]]=bar[(int)b[i]];
			bar[(int)b[i]]=p;
			
		} {
			//swap
			int p =bar[(int)a[i]];
			bar[(int)a[i]]=bar[(int)b[i]];
			bar[(int)b[i]]=p;
			
		} int p =bar[(int)a[i]]; p bar[(int)a[i]] bar (int)a[i] a i bar[(int)a[i]]=bar[(int)b[i]] bar[(int)a[i]] bar (int)a[i] a i bar[(int)b[i]] bar (int)b[i] b i bar[(int)b[i]]=p bar[(int)b[i]] bar (int)b[i] b i p for(i=1;i<=w;i++) {
			System.out.println(bar[i]);
		} i=1; i=1 i 1 i<=w i w i++ i++ i {
			System.out.println(bar[i]);
		} {
			System.out.println(bar[i]);
		} System.out.println(bar[i]) System.out.println System.out System System.out bar[i] bar i String[] args args public class Main {
	public static Scanner sc;
	
	public static void main(String[] args){
		//宣言
		sc = new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int a[]=new int[n+1];
		int b[]=new int[n+1];
		String s[]=new String[n+1];
		int i=0;
		for(i=1;i<=n;i++){
			String str =sc.next();
			String[] ab =str.split(",");
			a[i]= Integer.parseInt(ab[0]);
			b[i]=Integer.parseInt(ab[1]);
		}
		int bar[]=new int[w+1];
		for(i=1;i<=w;i++) {
			bar[i]=i;
		}
		//演算
		for(i=1;i<=n;i++) {
			//swap
			int p =bar[(int)a[i]];
			bar[(int)a[i]]=bar[(int)b[i]];
			bar[(int)b[i]]=p;
			
		}
		//出力
		for(i=1;i<=w;i++) {
			System.out.println(bar[i]);
		}
	}
} public class Main {
	public static Scanner sc;
	
	public static void main(String[] args){
		//宣言
		sc = new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int a[]=new int[n+1];
		int b[]=new int[n+1];
		String s[]=new String[n+1];
		int i=0;
		for(i=1;i<=n;i++){
			String str =sc.next();
			String[] ab =str.split(",");
			a[i]= Integer.parseInt(ab[0]);
			b[i]=Integer.parseInt(ab[1]);
		}
		int bar[]=new int[w+1];
		for(i=1;i<=w;i++) {
			bar[i]=i;
		}
		//演算
		for(i=1;i<=n;i++) {
			//swap
			int p =bar[(int)a[i]];
			bar[(int)a[i]]=bar[(int)b[i]];
			bar[(int)b[i]]=p;
			
		}
		//出力
		for(i=1;i<=w;i++) {
			System.out.println(bar[i]);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static Scanner sc;
	
	public static void main(String[] args){
		//宣言
		sc = new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int a[]=new int[n+1];
		int b[]=new int[n+1];
		String s[]=new String[n+1];
		int i=0;
		for(i=1;i<=n;i++){
			String str =sc.next();
			String[] ab =str.split(",");
			a[i]= Integer.parseInt(ab[0]);
			b[i]=Integer.parseInt(ab[1]);
		}
		int bar[]=new int[w+1];
		for(i=1;i<=w;i++) {
			bar[i]=i;
		}
		//演算
		for(i=1;i<=n;i++) {
			//swap
			int p =bar[(int)a[i]];
			bar[(int)a[i]]=bar[(int)b[i]];
			bar[(int)b[i]]=p;
			
		}
		//出力
		for(i=1;i<=w;i++) {
			System.out.println(bar[i]);
		}
	}
}
