import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()) {
		int b=sc.nextInt();
		int []a=new int[b];
		for(int i=0;i<b;i++) {
			a[i]=i+1;
			//System.out.print(a[i]);
		}//
		int s=sc.nextInt();
		for(int i=0;i<s;i++) {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		}
			for(int j=0;j<b;j++) {
				System.out.println(a[j]);
			}
	}
	}
	} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()) {
		int b=sc.nextInt();
		int []a=new int[b];
		for(int i=0;i<b;i++) {
			a[i]=i+1;
			//System.out.print(a[i]);
		}//
		int s=sc.nextInt();
		for(int i=0;i<s;i++) {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		}
			for(int j=0;j<b;j++) {
				System.out.println(a[j]);
			}
	}
	}
	} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()) {
		int b=sc.nextInt();
		int []a=new int[b];
		for(int i=0;i<b;i++) {
			a[i]=i+1;
			//System.out.print(a[i]);
		}//
		int s=sc.nextInt();
		for(int i=0;i<s;i++) {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		}
			for(int j=0;j<b;j++) {
				System.out.println(a[j]);
			}
	}
	} main {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()) {
		int b=sc.nextInt();
		int []a=new int[b];
		for(int i=0;i<b;i++) {
			a[i]=i+1;
			//System.out.print(a[i]);
		}//
		int s=sc.nextInt();
		for(int i=0;i<s;i++) {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		}
			for(int j=0;j<b;j++) {
				System.out.println(a[j]);
			}
	}
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) while(sc.hasNext()) {
		int b=sc.nextInt();
		int []a=new int[b];
		for(int i=0;i<b;i++) {
			a[i]=i+1;
			//System.out.print(a[i]);
		}//
		int s=sc.nextInt();
		for(int i=0;i<s;i++) {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		}
			for(int j=0;j<b;j++) {
				System.out.println(a[j]);
			}
	} sc.hasNext() sc.hasNext sc {
		int b=sc.nextInt();
		int []a=new int[b];
		for(int i=0;i<b;i++) {
			a[i]=i+1;
			//System.out.print(a[i]);
		}//
		int s=sc.nextInt();
		for(int i=0;i<s;i++) {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		}
			for(int j=0;j<b;j++) {
				System.out.println(a[j]);
			}
	} int b=sc.nextInt(); b sc.nextInt() sc.nextInt sc int []a=new int[b]; a new int[b] b for(int i=0;i<b;i++) {
			a[i]=i+1;
			//System.out.print(a[i]);
		}// int i=0; int i=0; i 0 i<b i b i++ i++ i {
			a[i]=i+1;
			//System.out.print(a[i]);
		}// {
			a[i]=i+1;
			//System.out.print(a[i]);
		} a[i]=i+1 a[i] a i i+1 i 1 int s=sc.nextInt(); s sc.nextInt() sc.nextInt sc for(int i=0;i<s;i++) {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		} int i=0; int i=0; i 0 i<s i s i++ i++ i {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		} {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		} String str = sc.next(); str sc.next() sc.next sc String Str[] = str.split(","); Str str.split(",") str.split str "," int p=Integer.parseInt(Str[0])-1; p Integer.parseInt(Str[0])-1 Integer.parseInt(Str[0]) Integer.parseInt Integer Str[0] Str 0 1 int q=Integer.parseInt(Str[1])-1; q Integer.parseInt(Str[1])-1 Integer.parseInt(Str[1]) Integer.parseInt Integer Str[1] Str 1 1 int temp; temp temp=a[p] temp a[p] a p a[p]=a[q] a[p] a p a[q] a q a[q]=temp a[q] a q temp for(int j=0;j<b;j++) {
				System.out.println(a[j]);
			} int j=0; int j=0; j 0 j<b j b j++ j++ j {
				System.out.println(a[j]);
			} {
				System.out.println(a[j]);
			} System.out.println(a[j]) System.out.println System.out System System.out a[j] a j String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()) {
		int b=sc.nextInt();
		int []a=new int[b];
		for(int i=0;i<b;i++) {
			a[i]=i+1;
			//System.out.print(a[i]);
		}//
		int s=sc.nextInt();
		for(int i=0;i<s;i++) {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		}
			for(int j=0;j<b;j++) {
				System.out.println(a[j]);
			}
	}
	}
	} public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()) {
		int b=sc.nextInt();
		int []a=new int[b];
		for(int i=0;i<b;i++) {
			a[i]=i+1;
			//System.out.print(a[i]);
		}//
		int s=sc.nextInt();
		for(int i=0;i<s;i++) {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		}
			for(int j=0;j<b;j++) {
				System.out.println(a[j]);
			}
	}
	}
	} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()) {
		int b=sc.nextInt();
		int []a=new int[b];
		for(int i=0;i<b;i++) {
			a[i]=i+1;
			//System.out.print(a[i]);
		}//
		int s=sc.nextInt();
		for(int i=0;i<s;i++) {
			   String str = sc.next();
			   String Str[] = str.split(",");
				 int p=Integer.parseInt(Str[0])-1;
				 int q=Integer.parseInt(Str[1])-1;	
				int temp;
				temp=a[p];
				a[p]=a[q];
				a[q]=temp;
		}
			for(int j=0;j<b;j++) {
				System.out.println(a[j]);
			}
	}
	}
	}
