
import java.util.*;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {//change to Main
    static int INF = Integer.MAX_VALUE;
    static int[][] near = {{0,0,1,-1},{1,-1,0,0}};
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));//
    static StringTokenizer st;
    static StringBuilder sb;
    static String line;


    public static void main(String[] args) throws Exception {

        //int T = Integer.parseInt(in.readLine());//number of messages
        int T =1;
        for (int t = 0; t < T; t++) {
            solve();
            //st = new StringTokenizer(in.readLine());
            //int x = Integer.parseInt(st.nextToken());

        }//forLoop#1
    }//main


    public static void solve() throws Exception{
        int w,n;
        w= Integer.parseInt(in.readLine());
        n= Integer.parseInt(in.readLine());

        int[] A = new int[w]; //array
        for (int i = 0; i < w; i++) {
            A[i] = i+1;
        }

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(in.readLine(),",");
            int a,b,temp;
            a = Integer.parseInt(st.nextToken())-1;
            b = Integer.parseInt(st.nextToken())-1;
            temp = A[a];
            A[a] = A[b];
            A[b] = temp;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(A[i]);
        }



    }
}//class import java.util.*; util.* java import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {//change to Main
    static int INF = Integer.MAX_VALUE;
    static int[][] near = {{0,0,1,-1},{1,-1,0,0}};
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));//
    static StringTokenizer st;
    static StringBuilder sb;
    static String line;


    public static void main(String[] args) throws Exception {

        //int T = Integer.parseInt(in.readLine());//number of messages
        int T =1;
        for (int t = 0; t < T; t++) {
            solve();
            //st = new StringTokenizer(in.readLine());
            //int x = Integer.parseInt(st.nextToken());

        }//forLoop#1
    }//main


    public static void solve() throws Exception{
        int w,n;
        w= Integer.parseInt(in.readLine());
        n= Integer.parseInt(in.readLine());

        int[] A = new int[w]; //array
        for (int i = 0; i < w; i++) {
            A[i] = i+1;
        }

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(in.readLine(),",");
            int a,b,temp;
            a = Integer.parseInt(st.nextToken())-1;
            b = Integer.parseInt(st.nextToken())-1;
            temp = A[a];
            A[a] = A[b];
            A[b] = temp;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(A[i]);
        }



    }
}//class Main static int INF = Integer.MAX_VALUE; INF Integer.MAX_VALUE Integer Integer.MAX_VALUE static int[][] near = {{0,0,1,-1},{1,-1,0,0}}; near {{0,0,1,-1},{1,-1,0,0}} {0,0,1,-1} 0 0 1 -1 1 {1,-1,0,0} 1 -1 1 0 0 static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));// in new BufferedReader(new InputStreamReader(System.in)) static StringTokenizer st; st static StringBuilder sb; sb static String line; line public static void main(String[] args) throws Exception {

        //int T = Integer.parseInt(in.readLine());//number of messages
        int T =1;
        for (int t = 0; t < T; t++) {
            solve();
            //st = new StringTokenizer(in.readLine());
            //int x = Integer.parseInt(st.nextToken());

        }//forLoop#1
    }//main main {

        //int T = Integer.parseInt(in.readLine());//number of messages
        int T =1;
        for (int t = 0; t < T; t++) {
            solve();
            //st = new StringTokenizer(in.readLine());
            //int x = Integer.parseInt(st.nextToken());

        }//forLoop#1
    } int T =1; T 1 for (int t = 0; t < T; t++) {
            solve();
            //st = new StringTokenizer(in.readLine());
            //int x = Integer.parseInt(st.nextToken());

        }//forLoop#1 int t = 0; int t = 0; t 0 t < T t T t++ t++ t {
            solve();
            //st = new StringTokenizer(in.readLine());
            //int x = Integer.parseInt(st.nextToken());

        }//forLoop#1 {
            solve();
            //st = new StringTokenizer(in.readLine());
            //int x = Integer.parseInt(st.nextToken());

        } solve() solve String[] args args public static void solve() throws Exception{
        int w,n;
        w= Integer.parseInt(in.readLine());
        n= Integer.parseInt(in.readLine());

        int[] A = new int[w]; //array
        for (int i = 0; i < w; i++) {
            A[i] = i+1;
        }

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(in.readLine(),",");
            int a,b,temp;
            a = Integer.parseInt(st.nextToken())-1;
            b = Integer.parseInt(st.nextToken())-1;
            temp = A[a];
            A[a] = A[b];
            A[b] = temp;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(A[i]);
        }



    } solve {
        int w,n;
        w= Integer.parseInt(in.readLine());
        n= Integer.parseInt(in.readLine());

        int[] A = new int[w]; //array
        for (int i = 0; i < w; i++) {
            A[i] = i+1;
        }

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(in.readLine(),",");
            int a,b,temp;
            a = Integer.parseInt(st.nextToken())-1;
            b = Integer.parseInt(st.nextToken())-1;
            temp = A[a];
            A[a] = A[b];
            A[b] = temp;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(A[i]);
        }



    } int w w n; n w= Integer.parseInt(in.readLine()) w Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in n= Integer.parseInt(in.readLine()) n Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine 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++) {
            st = new StringTokenizer(in.readLine(),",");
            int a,b,temp;
            a = Integer.parseInt(st.nextToken())-1;
            b = Integer.parseInt(st.nextToken())-1;
            temp = A[a];
            A[a] = A[b];
            A[b] = temp;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            st = new StringTokenizer(in.readLine(),",");
            int a,b,temp;
            a = Integer.parseInt(st.nextToken())-1;
            b = Integer.parseInt(st.nextToken())-1;
            temp = A[a];
            A[a] = A[b];
            A[b] = temp;
        } {
            st = new StringTokenizer(in.readLine(),",");
            int a,b,temp;
            a = Integer.parseInt(st.nextToken())-1;
            b = Integer.parseInt(st.nextToken())-1;
            temp = A[a];
            A[a] = A[b];
            A[b] = temp;
        } st = new StringTokenizer(in.readLine(),",") st new StringTokenizer(in.readLine(),",") int a a b b temp; temp a = Integer.parseInt(st.nextToken())-1 a Integer.parseInt(st.nextToken())-1 Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st 1 b = Integer.parseInt(st.nextToken())-1 b Integer.parseInt(st.nextToken())-1 Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st 1 temp = A[a] temp A[a] A a A[a] = A[b] A[a] A a A[b] A b A[b] = temp A[b] A b temp for (int i = 0; i < w; i++) {
            System.out.println(A[i]);
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            System.out.println(A[i]);
        } {
            System.out.println(A[i]);
        } System.out.println(A[i]) System.out.println System.out System System.out A[i] A i public class Main {//change to Main
    static int INF = Integer.MAX_VALUE;
    static int[][] near = {{0,0,1,-1},{1,-1,0,0}};
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));//
    static StringTokenizer st;
    static StringBuilder sb;
    static String line;


    public static void main(String[] args) throws Exception {

        //int T = Integer.parseInt(in.readLine());//number of messages
        int T =1;
        for (int t = 0; t < T; t++) {
            solve();
            //st = new StringTokenizer(in.readLine());
            //int x = Integer.parseInt(st.nextToken());

        }//forLoop#1
    }//main


    public static void solve() throws Exception{
        int w,n;
        w= Integer.parseInt(in.readLine());
        n= Integer.parseInt(in.readLine());

        int[] A = new int[w]; //array
        for (int i = 0; i < w; i++) {
            A[i] = i+1;
        }

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(in.readLine(),",");
            int a,b,temp;
            a = Integer.parseInt(st.nextToken())-1;
            b = Integer.parseInt(st.nextToken())-1;
            temp = A[a];
            A[a] = A[b];
            A[b] = temp;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(A[i]);
        }



    }
}//class public class Main {//change to Main
    static int INF = Integer.MAX_VALUE;
    static int[][] near = {{0,0,1,-1},{1,-1,0,0}};
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));//
    static StringTokenizer st;
    static StringBuilder sb;
    static String line;


    public static void main(String[] args) throws Exception {

        //int T = Integer.parseInt(in.readLine());//number of messages
        int T =1;
        for (int t = 0; t < T; t++) {
            solve();
            //st = new StringTokenizer(in.readLine());
            //int x = Integer.parseInt(st.nextToken());

        }//forLoop#1
    }//main


    public static void solve() throws Exception{
        int w,n;
        w= Integer.parseInt(in.readLine());
        n= Integer.parseInt(in.readLine());

        int[] A = new int[w]; //array
        for (int i = 0; i < w; i++) {
            A[i] = i+1;
        }

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(in.readLine(),",");
            int a,b,temp;
            a = Integer.parseInt(st.nextToken())-1;
            b = Integer.parseInt(st.nextToken())-1;
            temp = A[a];
            A[a] = A[b];
            A[b] = temp;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(A[i]);
        }



    }
}//class Main

import java.util.*;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {//change to Main
    static int INF = Integer.MAX_VALUE;
    static int[][] near = {{0,0,1,-1},{1,-1,0,0}};
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));//
    static StringTokenizer st;
    static StringBuilder sb;
    static String line;


    public static void main(String[] args) throws Exception {

        //int T = Integer.parseInt(in.readLine());//number of messages
        int T =1;
        for (int t = 0; t < T; t++) {
            solve();
            //st = new StringTokenizer(in.readLine());
            //int x = Integer.parseInt(st.nextToken());

        }//forLoop#1
    }//main


    public static void solve() throws Exception{
        int w,n;
        w= Integer.parseInt(in.readLine());
        n= Integer.parseInt(in.readLine());

        int[] A = new int[w]; //array
        for (int i = 0; i < w; i++) {
            A[i] = i+1;
        }

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(in.readLine(),",");
            int a,b,temp;
            a = Integer.parseInt(st.nextToken())-1;
            b = Integer.parseInt(st.nextToken())-1;
            temp = A[a];
            A[a] = A[b];
            A[b] = temp;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(A[i]);
        }



    }
}//class