import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		ArrayList<String> shuff= new ArrayList<String>();
		int w,n,tmp;
		int shuf_num[] =new int[2];
		String buf[]=new String[2];
		w=in.nextInt();
		n=in.nextInt();
		int a[]=new int[w];
		for (int i=0;i<w;i++) {
			a[i] = i+1;
		}
		for(int i=0;i<n;i++){
			buf =(in.next()).split(",",0);
			shuf_num[0]=Integer.parseInt(buf[0])-1;
			shuf_num[1]=Integer.parseInt(buf[1])-1;
			tmp=a[shuf_num[0]];
			a[shuf_num[0]]=a[shuf_num[1]];
			a[shuf_num[1]]=tmp;
		}
		for (int i=0;i<w;i++) {
				System.out.printf("%d%n",a[i]);
		}
	}
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util public class Main {
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		ArrayList<String> shuff= new ArrayList<String>();
		int w,n,tmp;
		int shuf_num[] =new int[2];
		String buf[]=new String[2];
		w=in.nextInt();
		n=in.nextInt();
		int a[]=new int[w];
		for (int i=0;i<w;i++) {
			a[i] = i+1;
		}
		for(int i=0;i<n;i++){
			buf =(in.next()).split(",",0);
			shuf_num[0]=Integer.parseInt(buf[0])-1;
			shuf_num[1]=Integer.parseInt(buf[1])-1;
			tmp=a[shuf_num[0]];
			a[shuf_num[0]]=a[shuf_num[1]];
			a[shuf_num[1]]=tmp;
		}
		for (int i=0;i<w;i++) {
				System.out.printf("%d%n",a[i]);
		}
	}
} Main public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		ArrayList<String> shuff= new ArrayList<String>();
		int w,n,tmp;
		int shuf_num[] =new int[2];
		String buf[]=new String[2];
		w=in.nextInt();
		n=in.nextInt();
		int a[]=new int[w];
		for (int i=0;i<w;i++) {
			a[i] = i+1;
		}
		for(int i=0;i<n;i++){
			buf =(in.next()).split(",",0);
			shuf_num[0]=Integer.parseInt(buf[0])-1;
			shuf_num[1]=Integer.parseInt(buf[1])-1;
			tmp=a[shuf_num[0]];
			a[shuf_num[0]]=a[shuf_num[1]];
			a[shuf_num[1]]=tmp;
		}
		for (int i=0;i<w;i++) {
				System.out.printf("%d%n",a[i]);
		}
	} main {
		Scanner in=new Scanner(System.in);
		ArrayList<String> shuff= new ArrayList<String>();
		int w,n,tmp;
		int shuf_num[] =new int[2];
		String buf[]=new String[2];
		w=in.nextInt();
		n=in.nextInt();
		int a[]=new int[w];
		for (int i=0;i<w;i++) {
			a[i] = i+1;
		}
		for(int i=0;i<n;i++){
			buf =(in.next()).split(",",0);
			shuf_num[0]=Integer.parseInt(buf[0])-1;
			shuf_num[1]=Integer.parseInt(buf[1])-1;
			tmp=a[shuf_num[0]];
			a[shuf_num[0]]=a[shuf_num[1]];
			a[shuf_num[1]]=tmp;
		}
		for (int i=0;i<w;i++) {
				System.out.printf("%d%n",a[i]);
		}
	} Scanner in=new Scanner(System.in); in new Scanner(System.in) ArrayList<String> shuff= new ArrayList<String>(); shuff new ArrayList<String>() int w w n n tmp; tmp int shuf_num[] =new int[2]; shuf_num new int[2] 2 String buf[]=new String[2]; buf new String[2] 2 w=in.nextInt() w in.nextInt() in.nextInt in n=in.nextInt() n in.nextInt() in.nextInt in int a[]=new int[w]; a new int[w] w for (int i=0;i<w;i++) {
			a[i] = i+1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			a[i] = i+1;
		} {
			a[i] = i+1;
		} a[i] = i+1 a[i] a i i+1 i 1 for(int i=0;i<n;i++){
			buf =(in.next()).split(",",0);
			shuf_num[0]=Integer.parseInt(buf[0])-1;
			shuf_num[1]=Integer.parseInt(buf[1])-1;
			tmp=a[shuf_num[0]];
			a[shuf_num[0]]=a[shuf_num[1]];
			a[shuf_num[1]]=tmp;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			buf =(in.next()).split(",",0);
			shuf_num[0]=Integer.parseInt(buf[0])-1;
			shuf_num[1]=Integer.parseInt(buf[1])-1;
			tmp=a[shuf_num[0]];
			a[shuf_num[0]]=a[shuf_num[1]];
			a[shuf_num[1]]=tmp;
		} {
			buf =(in.next()).split(",",0);
			shuf_num[0]=Integer.parseInt(buf[0])-1;
			shuf_num[1]=Integer.parseInt(buf[1])-1;
			tmp=a[shuf_num[0]];
			a[shuf_num[0]]=a[shuf_num[1]];
			a[shuf_num[1]]=tmp;
		} buf =(in.next()).split(",",0) buf (in.next()).split(",",0) (in.next()).split (in.next()) in.next in "," 0 shuf_num[0]=Integer.parseInt(buf[0])-1 shuf_num[0] shuf_num 0 Integer.parseInt(buf[0])-1 Integer.parseInt(buf[0]) Integer.parseInt Integer buf[0] buf 0 1 shuf_num[1]=Integer.parseInt(buf[1])-1 shuf_num[1] shuf_num 1 Integer.parseInt(buf[1])-1 Integer.parseInt(buf[1]) Integer.parseInt Integer buf[1] buf 1 1 tmp=a[shuf_num[0]] tmp a[shuf_num[0]] a shuf_num[0] shuf_num 0 a[shuf_num[0]]=a[shuf_num[1]] a[shuf_num[0]] a shuf_num[0] shuf_num 0 a[shuf_num[1]] a shuf_num[1] shuf_num 1 a[shuf_num[1]]=tmp a[shuf_num[1]] a shuf_num[1] shuf_num 1 tmp for (int i=0;i<w;i++) {
				System.out.printf("%d%n",a[i]);
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
				System.out.printf("%d%n",a[i]);
		} {
				System.out.printf("%d%n",a[i]);
		} System.out.printf("%d%n",a[i]) System.out.printf System.out System System.out "%d%n" a[i] a i String args[] args public class Main {
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		ArrayList<String> shuff= new ArrayList<String>();
		int w,n,tmp;
		int shuf_num[] =new int[2];
		String buf[]=new String[2];
		w=in.nextInt();
		n=in.nextInt();
		int a[]=new int[w];
		for (int i=0;i<w;i++) {
			a[i] = i+1;
		}
		for(int i=0;i<n;i++){
			buf =(in.next()).split(",",0);
			shuf_num[0]=Integer.parseInt(buf[0])-1;
			shuf_num[1]=Integer.parseInt(buf[1])-1;
			tmp=a[shuf_num[0]];
			a[shuf_num[0]]=a[shuf_num[1]];
			a[shuf_num[1]]=tmp;
		}
		for (int i=0;i<w;i++) {
				System.out.printf("%d%n",a[i]);
		}
	}
} public class Main {
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		ArrayList<String> shuff= new ArrayList<String>();
		int w,n,tmp;
		int shuf_num[] =new int[2];
		String buf[]=new String[2];
		w=in.nextInt();
		n=in.nextInt();
		int a[]=new int[w];
		for (int i=0;i<w;i++) {
			a[i] = i+1;
		}
		for(int i=0;i<n;i++){
			buf =(in.next()).split(",",0);
			shuf_num[0]=Integer.parseInt(buf[0])-1;
			shuf_num[1]=Integer.parseInt(buf[1])-1;
			tmp=a[shuf_num[0]];
			a[shuf_num[0]]=a[shuf_num[1]];
			a[shuf_num[1]]=tmp;
		}
		for (int i=0;i<w;i++) {
				System.out.printf("%d%n",a[i]);
		}
	}
} Main
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		ArrayList<String> shuff= new ArrayList<String>();
		int w,n,tmp;
		int shuf_num[] =new int[2];
		String buf[]=new String[2];
		w=in.nextInt();
		n=in.nextInt();
		int a[]=new int[w];
		for (int i=0;i<w;i++) {
			a[i] = i+1;
		}
		for(int i=0;i<n;i++){
			buf =(in.next()).split(",",0);
			shuf_num[0]=Integer.parseInt(buf[0])-1;
			shuf_num[1]=Integer.parseInt(buf[1])-1;
			tmp=a[shuf_num[0]];
			a[shuf_num[0]]=a[shuf_num[1]];
			a[shuf_num[1]]=tmp;
		}
		for (int i=0;i<w;i++) {
				System.out.printf("%d%n",a[i]);
		}
	}
}