import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		try{
			int w=Integer.parseInt(br.readLine());
			int n=Integer.parseInt(br.readLine());
			int rep;
			int[] line=new int[w+1];
			for(int i=1;i<=w;i++){	//line[]に1〜wを代入
				line[i]=i;
			}
			int a,b;
			String[] str=new String[2];
			for(int i=0;i<n;i++){
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			}
			for(int i=1;i<=w;i++){
				System.out.println(line[i]);
			}
		}catch(Exception e){
		}
	}
} import java.io.*; io.* java public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		try{
			int w=Integer.parseInt(br.readLine());
			int n=Integer.parseInt(br.readLine());
			int rep;
			int[] line=new int[w+1];
			for(int i=1;i<=w;i++){	//line[]に1〜wを代入
				line[i]=i;
			}
			int a,b;
			String[] str=new String[2];
			for(int i=0;i<n;i++){
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			}
			for(int i=1;i<=w;i++){
				System.out.println(line[i]);
			}
		}catch(Exception e){
		}
	}
} Main public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		try{
			int w=Integer.parseInt(br.readLine());
			int n=Integer.parseInt(br.readLine());
			int rep;
			int[] line=new int[w+1];
			for(int i=1;i<=w;i++){	//line[]に1〜wを代入
				line[i]=i;
			}
			int a,b;
			String[] str=new String[2];
			for(int i=0;i<n;i++){
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			}
			for(int i=1;i<=w;i++){
				System.out.println(line[i]);
			}
		}catch(Exception e){
		}
	} main {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		try{
			int w=Integer.parseInt(br.readLine());
			int n=Integer.parseInt(br.readLine());
			int rep;
			int[] line=new int[w+1];
			for(int i=1;i<=w;i++){	//line[]に1〜wを代入
				line[i]=i;
			}
			int a,b;
			String[] str=new String[2];
			for(int i=0;i<n;i++){
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			}
			for(int i=1;i<=w;i++){
				System.out.println(line[i]);
			}
		}catch(Exception e){
		}
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try{
			int w=Integer.parseInt(br.readLine());
			int n=Integer.parseInt(br.readLine());
			int rep;
			int[] line=new int[w+1];
			for(int i=1;i<=w;i++){	//line[]に1〜wを代入
				line[i]=i;
			}
			int a,b;
			String[] str=new String[2];
			for(int i=0;i<n;i++){
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			}
			for(int i=1;i<=w;i++){
				System.out.println(line[i]);
			}
		}catch(Exception e){
		} catch(Exception e){
		} Exception e {
		} {
			int w=Integer.parseInt(br.readLine());
			int n=Integer.parseInt(br.readLine());
			int rep;
			int[] line=new int[w+1];
			for(int i=1;i<=w;i++){	//line[]に1〜wを代入
				line[i]=i;
			}
			int a,b;
			String[] str=new String[2];
			for(int i=0;i<n;i++){
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			}
			for(int i=1;i<=w;i++){
				System.out.println(line[i]);
			}
		} int w=Integer.parseInt(br.readLine()); w Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int n=Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int rep; rep int[] line=new int[w+1]; line new int[w+1] w+1 w 1 for(int i=1;i<=w;i++){	//line[]に1〜wを代入
				line[i]=i;
			} int i=1; int i=1; i 1 i<=w i w i++ i++ i {	//line[]に1〜wを代入
				line[i]=i;
			} {	//line[]に1〜wを代入
				line[i]=i;
			} line[i]=i line[i] line i i int a a b; b String[] str=new String[2]; str new String[2] 2 for(int i=0;i<n;i++){
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			} int i=0; int i=0; i 0 i<n i n i++ i++ i {
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			} {
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			} str=br.readLine().split(",") str br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," a=Integer.parseInt(str[0]) a Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 b=Integer.parseInt(str[1]) b Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 rep=line[a] rep line[a] line a line[a]=line[b] line[a] line a line[b] line b line[b]=rep line[b] line b rep for(int i=1;i<=w;i++){
				System.out.println(line[i]);
			} int i=1; int i=1; i 1 i<=w i w i++ i++ i {
				System.out.println(line[i]);
			} {
				System.out.println(line[i]);
			} System.out.println(line[i]) System.out.println System.out System System.out line[i] line i String[] args args public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		try{
			int w=Integer.parseInt(br.readLine());
			int n=Integer.parseInt(br.readLine());
			int rep;
			int[] line=new int[w+1];
			for(int i=1;i<=w;i++){	//line[]に1〜wを代入
				line[i]=i;
			}
			int a,b;
			String[] str=new String[2];
			for(int i=0;i<n;i++){
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			}
			for(int i=1;i<=w;i++){
				System.out.println(line[i]);
			}
		}catch(Exception e){
		}
	}
} public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		try{
			int w=Integer.parseInt(br.readLine());
			int n=Integer.parseInt(br.readLine());
			int rep;
			int[] line=new int[w+1];
			for(int i=1;i<=w;i++){	//line[]に1〜wを代入
				line[i]=i;
			}
			int a,b;
			String[] str=new String[2];
			for(int i=0;i<n;i++){
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			}
			for(int i=1;i<=w;i++){
				System.out.println(line[i]);
			}
		}catch(Exception e){
		}
	}
} Main
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		try{
			int w=Integer.parseInt(br.readLine());
			int n=Integer.parseInt(br.readLine());
			int rep;
			int[] line=new int[w+1];
			for(int i=1;i<=w;i++){	//line[]に1〜wを代入
				line[i]=i;
			}
			int a,b;
			String[] str=new String[2];
			for(int i=0;i<n;i++){
				str=br.readLine().split(",");
				a=Integer.parseInt(str[0]);
				b=Integer.parseInt(str[1]);
				rep=line[a];	//line[a]とline[b]を入換
				line[a]=line[b];
				line[b]=rep;
			}
			for(int i=1;i<=w;i++){
				System.out.println(line[i]);
			}
		}catch(Exception e){
		}
	}
}