import java.util.*;
class Main{
 
    public static void main(String args[]){
    int w,n;
    int[][] Edge;
    int[] Ans;
    Scanner in = new Scanner(System.in);
    String[] s;
 
      
    w = in.nextInt();
    n = in.nextInt();
    Edge = new int[w+1][2];
    Ans = new int[w+1];
    for(int i=1;i<=w;i++)Ans[i] = i;
    for(int i=0;i<n;i++){
        s = in.next().split(",");
        Edge[i][0] = Integer.valueOf(s[0]).intValue();
        Edge[i][1] = Integer.valueOf(s[1]).intValue();
        int h = Ans[Edge[i][0]];
        Ans[Edge[i][0]] = Ans[Edge[i][1]];
        Ans[Edge[i][1]] = h;
    }
     
    for(int i=1;i<=w;i++)System.out.println(Ans[i]);
 
    }
 
 
 
} import java.util.*; util.* java class Main{
 
    public static void main(String args[]){
    int w,n;
    int[][] Edge;
    int[] Ans;
    Scanner in = new Scanner(System.in);
    String[] s;
 
      
    w = in.nextInt();
    n = in.nextInt();
    Edge = new int[w+1][2];
    Ans = new int[w+1];
    for(int i=1;i<=w;i++)Ans[i] = i;
    for(int i=0;i<n;i++){
        s = in.next().split(",");
        Edge[i][0] = Integer.valueOf(s[0]).intValue();
        Edge[i][1] = Integer.valueOf(s[1]).intValue();
        int h = Ans[Edge[i][0]];
        Ans[Edge[i][0]] = Ans[Edge[i][1]];
        Ans[Edge[i][1]] = h;
    }
     
    for(int i=1;i<=w;i++)System.out.println(Ans[i]);
 
    }
 
 
 
} Main public static void main(String args[]){
    int w,n;
    int[][] Edge;
    int[] Ans;
    Scanner in = new Scanner(System.in);
    String[] s;
 
      
    w = in.nextInt();
    n = in.nextInt();
    Edge = new int[w+1][2];
    Ans = new int[w+1];
    for(int i=1;i<=w;i++)Ans[i] = i;
    for(int i=0;i<n;i++){
        s = in.next().split(",");
        Edge[i][0] = Integer.valueOf(s[0]).intValue();
        Edge[i][1] = Integer.valueOf(s[1]).intValue();
        int h = Ans[Edge[i][0]];
        Ans[Edge[i][0]] = Ans[Edge[i][1]];
        Ans[Edge[i][1]] = h;
    }
     
    for(int i=1;i<=w;i++)System.out.println(Ans[i]);
 
    } main {
    int w,n;
    int[][] Edge;
    int[] Ans;
    Scanner in = new Scanner(System.in);
    String[] s;
 
      
    w = in.nextInt();
    n = in.nextInt();
    Edge = new int[w+1][2];
    Ans = new int[w+1];
    for(int i=1;i<=w;i++)Ans[i] = i;
    for(int i=0;i<n;i++){
        s = in.next().split(",");
        Edge[i][0] = Integer.valueOf(s[0]).intValue();
        Edge[i][1] = Integer.valueOf(s[1]).intValue();
        int h = Ans[Edge[i][0]];
        Ans[Edge[i][0]] = Ans[Edge[i][1]];
        Ans[Edge[i][1]] = h;
    }
     
    for(int i=1;i<=w;i++)System.out.println(Ans[i]);
 
    } int w w n; n int[][] Edge; Edge int[] Ans; Ans Scanner in = new Scanner(System.in); in new Scanner(System.in) String[] s; s w = in.nextInt() w in.nextInt() in.nextInt in n = in.nextInt() n in.nextInt() in.nextInt in Edge = new int[w+1][2] Edge new int[w+1][2] w+1 w 1 2 Ans = new int[w+1] Ans new int[w+1] w+1 w 1 for(int i=1;i<=w;i++)Ans[i] = i; int i=1; int i=1; i 1 i<=w i w i++ i++ i Ans[i] = i; Ans[i] = i Ans[i] Ans i i for(int i=0;i<n;i++){
        s = in.next().split(",");
        Edge[i][0] = Integer.valueOf(s[0]).intValue();
        Edge[i][1] = Integer.valueOf(s[1]).intValue();
        int h = Ans[Edge[i][0]];
        Ans[Edge[i][0]] = Ans[Edge[i][1]];
        Ans[Edge[i][1]] = h;
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
        s = in.next().split(",");
        Edge[i][0] = Integer.valueOf(s[0]).intValue();
        Edge[i][1] = Integer.valueOf(s[1]).intValue();
        int h = Ans[Edge[i][0]];
        Ans[Edge[i][0]] = Ans[Edge[i][1]];
        Ans[Edge[i][1]] = h;
    } {
        s = in.next().split(",");
        Edge[i][0] = Integer.valueOf(s[0]).intValue();
        Edge[i][1] = Integer.valueOf(s[1]).intValue();
        int h = Ans[Edge[i][0]];
        Ans[Edge[i][0]] = Ans[Edge[i][1]];
        Ans[Edge[i][1]] = h;
    } s = in.next().split(",") s in.next().split(",") in.next().split in.next() in.next in "," Edge[i][0] = Integer.valueOf(s[0]).intValue() Edge[i][0] Edge[i] Edge i 0 Integer.valueOf(s[0]).intValue() Integer.valueOf(s[0]).intValue Integer.valueOf(s[0]) Integer.valueOf Integer s[0] s 0 Edge[i][1] = Integer.valueOf(s[1]).intValue() Edge[i][1] Edge[i] Edge i 1 Integer.valueOf(s[1]).intValue() Integer.valueOf(s[1]).intValue Integer.valueOf(s[1]) Integer.valueOf Integer s[1] s 1 int h = Ans[Edge[i][0]]; h Ans[Edge[i][0]] Ans Edge[i][0] Edge[i] Edge i 0 Ans[Edge[i][0]] = Ans[Edge[i][1]] Ans[Edge[i][0]] Ans Edge[i][0] Edge[i] Edge i 0 Ans[Edge[i][1]] Ans Edge[i][1] Edge[i] Edge i 1 Ans[Edge[i][1]] = h Ans[Edge[i][1]] Ans Edge[i][1] Edge[i] Edge i 1 h for(int i=1;i<=w;i++)System.out.println(Ans[i]); int i=1; int i=1; i 1 i<=w i w i++ i++ i System.out.println(Ans[i]); System.out.println(Ans[i]) System.out.println System.out System System.out Ans[i] Ans i String args[] args
import java.util.*;
class Main{
 
    public static void main(String args[]){
    int w,n;
    int[][] Edge;
    int[] Ans;
    Scanner in = new Scanner(System.in);
    String[] s;
 
      
    w = in.nextInt();
    n = in.nextInt();
    Edge = new int[w+1][2];
    Ans = new int[w+1];
    for(int i=1;i<=w;i++)Ans[i] = i;
    for(int i=0;i<n;i++){
        s = in.next().split(",");
        Edge[i][0] = Integer.valueOf(s[0]).intValue();
        Edge[i][1] = Integer.valueOf(s[1]).intValue();
        int h = Ans[Edge[i][0]];
        Ans[Edge[i][0]] = Ans[Edge[i][1]];
        Ans[Edge[i][1]] = h;
    }
     
    for(int i=1;i<=w;i++)System.out.println(Ans[i]);
 
    }
 
 
 
}
