import java.util.Scanner;

class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int n=sc.nextInt();
int[] k=new int[w];
for(int i=0;i<w;i++){
k[i]=i+1;
}
for(int j=0;j<n;j++){
String[] line=sc.next().split(",");
int p=Integer.parseInt(line[0]);
int q=Integer.parseInt(line[1]);
int r=k[p-1];
k[p-1]=k[q-1];
k[q-1]=r;
}
for(int l=0;l<w;l++){
System.out.println(k[l]);
}
}
} import java.util.Scanner; Scanner java.util class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int n=sc.nextInt();
int[] k=new int[w];
for(int i=0;i<w;i++){
k[i]=i+1;
}
for(int j=0;j<n;j++){
String[] line=sc.next().split(",");
int p=Integer.parseInt(line[0]);
int q=Integer.parseInt(line[1]);
int r=k[p-1];
k[p-1]=k[q-1];
k[q-1]=r;
}
for(int l=0;l<w;l++){
System.out.println(k[l]);
}
}
} Main public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int n=sc.nextInt();
int[] k=new int[w];
for(int i=0;i<w;i++){
k[i]=i+1;
}
for(int j=0;j<n;j++){
String[] line=sc.next().split(",");
int p=Integer.parseInt(line[0]);
int q=Integer.parseInt(line[1]);
int r=k[p-1];
k[p-1]=k[q-1];
k[q-1]=r;
}
for(int l=0;l<w;l++){
System.out.println(k[l]);
}
} main {
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int n=sc.nextInt();
int[] k=new int[w];
for(int i=0;i<w;i++){
k[i]=i+1;
}
for(int j=0;j<n;j++){
String[] line=sc.next().split(",");
int p=Integer.parseInt(line[0]);
int q=Integer.parseInt(line[1]);
int r=k[p-1];
k[p-1]=k[q-1];
k[q-1]=r;
}
for(int l=0;l<w;l++){
System.out.println(k[l]);
}
} Scanner 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[] k=new int[w]; k new int[w] w for(int i=0;i<w;i++){
k[i]=i+1;
} int i=0; int i=0; i 0 i<w i w i++ i++ i {
k[i]=i+1;
} {
k[i]=i+1;
} k[i]=i+1 k[i] k i i+1 i 1 for(int j=0;j<n;j++){
String[] line=sc.next().split(",");
int p=Integer.parseInt(line[0]);
int q=Integer.parseInt(line[1]);
int r=k[p-1];
k[p-1]=k[q-1];
k[q-1]=r;
} int j=0; int j=0; j 0 j<n j n j++ j++ j {
String[] line=sc.next().split(",");
int p=Integer.parseInt(line[0]);
int q=Integer.parseInt(line[1]);
int r=k[p-1];
k[p-1]=k[q-1];
k[q-1]=r;
} {
String[] line=sc.next().split(",");
int p=Integer.parseInt(line[0]);
int q=Integer.parseInt(line[1]);
int r=k[p-1];
k[p-1]=k[q-1];
k[q-1]=r;
} String[] line=sc.next().split(","); line sc.next().split(",") sc.next().split sc.next() sc.next sc "," int p=Integer.parseInt(line[0]); p Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int q=Integer.parseInt(line[1]); q Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 int r=k[p-1]; r k[p-1] k p-1 p 1 k[p-1]=k[q-1] k[p-1] k p-1 p 1 k[q-1] k q-1 q 1 k[q-1]=r k[q-1] k q-1 q 1 r for(int l=0;l<w;l++){
System.out.println(k[l]);
} int l=0; int l=0; l 0 l<w l w l++ l++ l {
System.out.println(k[l]);
} {
System.out.println(k[l]);
} System.out.println(k[l]) System.out.println System.out System System.out k[l] k l String[] args args
import java.util.Scanner;

class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int n=sc.nextInt();
int[] k=new int[w];
for(int i=0;i<w;i++){
k[i]=i+1;
}
for(int j=0;j<n;j++){
String[] line=sc.next().split(",");
int p=Integer.parseInt(line[0]);
int q=Integer.parseInt(line[1]);
int r=k[p-1];
k[p-1]=k[q-1];
k[q-1]=r;
}
for(int l=0;l<w;l++){
System.out.println(k[l]);
}
}
}