import java.io.*;
import java.util.Scanner;
public class Main{ 
  public static void main(String[]args){ 
    Scanner sc = new Scanner(System.in);
int w = sc.nextInt(); 
int n= sc.nextInt();
    int [] a = new int[30];
    int [] b = new int[30];
    int [] S = new int[30];
    int i=0,j=0,k=0,p,q;
    while(j<w){
      S[j]=j + 1;
      j++;
    }
    while(i<n){
      String str = sc.next();       
      String[] ab = str.split(","); 
      a[i] = Integer.parseInt(ab[0]);
      b[i] = Integer.parseInt(ab[1]);
      p=S[a[i]-1];
      S[a[i]-1]=S[b[i]-1];
      S[b[i]-1]=p;
      i++;
    }
    while(k<w){
      System.out.printf("%d\n",S[k]);
      k++;
    }
  }
} import java.io.*; io.* java import java.util.Scanner; Scanner java.util public class Main{ 
  public static void main(String[]args){ 
    Scanner sc = new Scanner(System.in);
int w = sc.nextInt(); 
int n= sc.nextInt();
    int [] a = new int[30];
    int [] b = new int[30];
    int [] S = new int[30];
    int i=0,j=0,k=0,p,q;
    while(j<w){
      S[j]=j + 1;
      j++;
    }
    while(i<n){
      String str = sc.next();       
      String[] ab = str.split(","); 
      a[i] = Integer.parseInt(ab[0]);
      b[i] = Integer.parseInt(ab[1]);
      p=S[a[i]-1];
      S[a[i]-1]=S[b[i]-1];
      S[b[i]-1]=p;
      i++;
    }
    while(k<w){
      System.out.printf("%d\n",S[k]);
      k++;
    }
  }
} Main public static void main(String[]args){ 
    Scanner sc = new Scanner(System.in);
int w = sc.nextInt(); 
int n= sc.nextInt();
    int [] a = new int[30];
    int [] b = new int[30];
    int [] S = new int[30];
    int i=0,j=0,k=0,p,q;
    while(j<w){
      S[j]=j + 1;
      j++;
    }
    while(i<n){
      String str = sc.next();       
      String[] ab = str.split(","); 
      a[i] = Integer.parseInt(ab[0]);
      b[i] = Integer.parseInt(ab[1]);
      p=S[a[i]-1];
      S[a[i]-1]=S[b[i]-1];
      S[b[i]-1]=p;
      i++;
    }
    while(k<w){
      System.out.printf("%d\n",S[k]);
      k++;
    }
  } main { 
    Scanner sc = new Scanner(System.in);
int w = sc.nextInt(); 
int n= sc.nextInt();
    int [] a = new int[30];
    int [] b = new int[30];
    int [] S = new int[30];
    int i=0,j=0,k=0,p,q;
    while(j<w){
      S[j]=j + 1;
      j++;
    }
    while(i<n){
      String str = sc.next();       
      String[] ab = str.split(","); 
      a[i] = Integer.parseInt(ab[0]);
      b[i] = Integer.parseInt(ab[1]);
      p=S[a[i]-1];
      S[a[i]-1]=S[b[i]-1];
      S[b[i]-1]=p;
      i++;
    }
    while(k<w){
      System.out.printf("%d\n",S[k]);
      k++;
    }
  } 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 [] a = new int[30]; a new int[30] 30 int [] b = new int[30]; b new int[30] 30 int [] S = new int[30]; S new int[30] 30 int i=0 i 0 j=0 j 0 k=0 k 0 p p q; q while(j<w){
      S[j]=j + 1;
      j++;
    } j<w j w {
      S[j]=j + 1;
      j++;
    } S[j]=j + 1 S[j] S j j + 1 j 1 j++ j while(i<n){
      String str = sc.next();       
      String[] ab = str.split(","); 
      a[i] = Integer.parseInt(ab[0]);
      b[i] = Integer.parseInt(ab[1]);
      p=S[a[i]-1];
      S[a[i]-1]=S[b[i]-1];
      S[b[i]-1]=p;
      i++;
    } i<n i n {
      String str = sc.next();       
      String[] ab = str.split(","); 
      a[i] = Integer.parseInt(ab[0]);
      b[i] = Integer.parseInt(ab[1]);
      p=S[a[i]-1];
      S[a[i]-1]=S[b[i]-1];
      S[b[i]-1]=p;
      i++;
    } String str = sc.next(); str sc.next() sc.next sc String[] ab = str.split(","); ab str.split(",") str.split str "," a[i] = Integer.parseInt(ab[0]) a[i] a i Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 b[i] = Integer.parseInt(ab[1]) b[i] b i Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 p=S[a[i]-1] p S[a[i]-1] S a[i]-1 a[i] a i 1 S[a[i]-1]=S[b[i]-1] S[a[i]-1] S a[i]-1 a[i] a i 1 S[b[i]-1] S b[i]-1 b[i] b i 1 S[b[i]-1]=p S[b[i]-1] S b[i]-1 b[i] b i 1 p i++ i while(k<w){
      System.out.printf("%d\n",S[k]);
      k++;
    } k<w k w {
      System.out.printf("%d\n",S[k]);
      k++;
    } System.out.printf("%d\n",S[k]) System.out.printf System.out System System.out "%d\n" S[k] S k k++ k String[]args args public class Main{ 
  public static void main(String[]args){ 
    Scanner sc = new Scanner(System.in);
int w = sc.nextInt(); 
int n= sc.nextInt();
    int [] a = new int[30];
    int [] b = new int[30];
    int [] S = new int[30];
    int i=0,j=0,k=0,p,q;
    while(j<w){
      S[j]=j + 1;
      j++;
    }
    while(i<n){
      String str = sc.next();       
      String[] ab = str.split(","); 
      a[i] = Integer.parseInt(ab[0]);
      b[i] = Integer.parseInt(ab[1]);
      p=S[a[i]-1];
      S[a[i]-1]=S[b[i]-1];
      S[b[i]-1]=p;
      i++;
    }
    while(k<w){
      System.out.printf("%d\n",S[k]);
      k++;
    }
  }
} public class Main{ 
  public static void main(String[]args){ 
    Scanner sc = new Scanner(System.in);
int w = sc.nextInt(); 
int n= sc.nextInt();
    int [] a = new int[30];
    int [] b = new int[30];
    int [] S = new int[30];
    int i=0,j=0,k=0,p,q;
    while(j<w){
      S[j]=j + 1;
      j++;
    }
    while(i<n){
      String str = sc.next();       
      String[] ab = str.split(","); 
      a[i] = Integer.parseInt(ab[0]);
      b[i] = Integer.parseInt(ab[1]);
      p=S[a[i]-1];
      S[a[i]-1]=S[b[i]-1];
      S[b[i]-1]=p;
      i++;
    }
    while(k<w){
      System.out.printf("%d\n",S[k]);
      k++;
    }
  }
} Main
import java.io.*;
import java.util.Scanner;
public class Main{ 
  public static void main(String[]args){ 
    Scanner sc = new Scanner(System.in);
int w = sc.nextInt(); 
int n= sc.nextInt();
    int [] a = new int[30];
    int [] b = new int[30];
    int [] S = new int[30];
    int i=0,j=0,k=0,p,q;
    while(j<w){
      S[j]=j + 1;
      j++;
    }
    while(i<n){
      String str = sc.next();       
      String[] ab = str.split(","); 
      a[i] = Integer.parseInt(ab[0]);
      b[i] = Integer.parseInt(ab[1]);
      p=S[a[i]-1];
      S[a[i]-1]=S[b[i]-1];
      S[b[i]-1]=p;
      i++;
    }
    while(k<w){
      System.out.printf("%d\n",S[k]);
      k++;
    }
  }
}