import java.io.*;

class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br=
				new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int m=Integer.parseInt(br.readLine());
		int[] line=new int[n];
		for(int i=0;i<n;i++){
			line[i]=i+1;
		}
		for(int i=0;i<m;i++){
			String buf2=br.readLine();
			String[] buf=buf2.split(",");
			int[] data=new int[2];
			for(int j=0;j<2;j++)	data[j]=(Integer.parseInt(buf[j])-1);
		int temp=line[data[0]];
		line[data[0]]=line[data[1]];
		line[data[1]]=temp;
		}
		for(int i=0;i<n;i++){
			System.out.println(line[i]);
		}
	}
} import java.io.*; io.* java class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br=
				new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int m=Integer.parseInt(br.readLine());
		int[] line=new int[n];
		for(int i=0;i<n;i++){
			line[i]=i+1;
		}
		for(int i=0;i<m;i++){
			String buf2=br.readLine();
			String[] buf=buf2.split(",");
			int[] data=new int[2];
			for(int j=0;j<2;j++)	data[j]=(Integer.parseInt(buf[j])-1);
		int temp=line[data[0]];
		line[data[0]]=line[data[1]];
		line[data[1]]=temp;
		}
		for(int i=0;i<n;i++){
			System.out.println(line[i]);
		}
	}
} Main public static void main(String[] args)throws IOException{
		BufferedReader br=
				new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int m=Integer.parseInt(br.readLine());
		int[] line=new int[n];
		for(int i=0;i<n;i++){
			line[i]=i+1;
		}
		for(int i=0;i<m;i++){
			String buf2=br.readLine();
			String[] buf=buf2.split(",");
			int[] data=new int[2];
			for(int j=0;j<2;j++)	data[j]=(Integer.parseInt(buf[j])-1);
		int temp=line[data[0]];
		line[data[0]]=line[data[1]];
		line[data[1]]=temp;
		}
		for(int i=0;i<n;i++){
			System.out.println(line[i]);
		}
	} main {
		BufferedReader br=
				new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int m=Integer.parseInt(br.readLine());
		int[] line=new int[n];
		for(int i=0;i<n;i++){
			line[i]=i+1;
		}
		for(int i=0;i<m;i++){
			String buf2=br.readLine();
			String[] buf=buf2.split(",");
			int[] data=new int[2];
			for(int j=0;j<2;j++)	data[j]=(Integer.parseInt(buf[j])-1);
		int temp=line[data[0]];
		line[data[0]]=line[data[1]];
		line[data[1]]=temp;
		}
		for(int i=0;i<n;i++){
			System.out.println(line[i]);
		}
	} BufferedReader br=
				new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n=Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int m=Integer.parseInt(br.readLine()); m Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] line=new int[n]; line new int[n] n for(int i=0;i<n;i++){
			line[i]=i+1;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			line[i]=i+1;
		} {
			line[i]=i+1;
		} line[i]=i+1 line[i] line i i+1 i 1 for(int i=0;i<m;i++){
			String buf2=br.readLine();
			String[] buf=buf2.split(",");
			int[] data=new int[2];
			for(int j=0;j<2;j++)	data[j]=(Integer.parseInt(buf[j])-1);
		int temp=line[data[0]];
		line[data[0]]=line[data[1]];
		line[data[1]]=temp;
		} int i=0; int i=0; i 0 i<m i m i++ i++ i {
			String buf2=br.readLine();
			String[] buf=buf2.split(",");
			int[] data=new int[2];
			for(int j=0;j<2;j++)	data[j]=(Integer.parseInt(buf[j])-1);
		int temp=line[data[0]];
		line[data[0]]=line[data[1]];
		line[data[1]]=temp;
		} {
			String buf2=br.readLine();
			String[] buf=buf2.split(",");
			int[] data=new int[2];
			for(int j=0;j<2;j++)	data[j]=(Integer.parseInt(buf[j])-1);
		int temp=line[data[0]];
		line[data[0]]=line[data[1]];
		line[data[1]]=temp;
		} String buf2=br.readLine(); buf2 br.readLine() br.readLine br String[] buf=buf2.split(","); buf buf2.split(",") buf2.split buf2 "," int[] data=new int[2]; data new int[2] 2 for(int j=0;j<2;j++)	data[j]=(Integer.parseInt(buf[j])-1); int j=0; int j=0; j 0 j<2 j 2 j++ j++ j data[j]=(Integer.parseInt(buf[j])-1); data[j]=(Integer.parseInt(buf[j])-1) data[j] data j (Integer.parseInt(buf[j])-1) Integer.parseInt(buf[j]) Integer.parseInt Integer buf[j] buf j 1 int temp=line[data[0]]; temp line[data[0]] line data[0] data 0 line[data[0]]=line[data[1]] line[data[0]] line data[0] data 0 line[data[1]] line data[1] data 1 line[data[1]]=temp line[data[1]] line data[1] data 1 temp for(int i=0;i<n;i++){
			System.out.println(line[i]);
		} int i=0; int i=0; i 0 i<n i n 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
import java.io.*;

class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br=
				new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int m=Integer.parseInt(br.readLine());
		int[] line=new int[n];
		for(int i=0;i<n;i++){
			line[i]=i+1;
		}
		for(int i=0;i<m;i++){
			String buf2=br.readLine();
			String[] buf=buf2.split(",");
			int[] data=new int[2];
			for(int j=0;j<2;j++)	data[j]=(Integer.parseInt(buf[j])-1);
		int temp=line[data[0]];
		line[data[0]]=line[data[1]];
		line[data[1]]=temp;
		}
		for(int i=0;i<n;i++){
			System.out.println(line[i]);
		}
	}
}