import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());
            int[] x = new int[w];
            for(int i = 0; i< w; i++){
                x[i] = i + 1;
            }
            int a ;
            int b ;
            for(int i = 0; i < n; i++){
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            }
            for(int i = 0; i < w; i++){
                System.out.println(x[i]);
            }
        }catch(IOException e){

        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());
            int[] x = new int[w];
            for(int i = 0; i< w; i++){
                x[i] = i + 1;
            }
            int a ;
            int b ;
            for(int i = 0; i < n; i++){
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            }
            for(int i = 0; i < w; i++){
                System.out.println(x[i]);
            }
        }catch(IOException e){

        }
    }
} Main public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());
            int[] x = new int[w];
            for(int i = 0; i< w; i++){
                x[i] = i + 1;
            }
            int a ;
            int b ;
            for(int i = 0; i < n; i++){
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            }
            for(int i = 0; i < w; i++){
                System.out.println(x[i]);
            }
        }catch(IOException e){

        }
    } main {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());
            int[] x = new int[w];
            for(int i = 0; i< w; i++){
                x[i] = i + 1;
            }
            int a ;
            int b ;
            for(int i = 0; i < n; i++){
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            }
            for(int i = 0; i < w; i++){
                System.out.println(x[i]);
            }
        }catch(IOException e){

        }
    } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) try{
            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());
            int[] x = new int[w];
            for(int i = 0; i< w; i++){
                x[i] = i + 1;
            }
            int a ;
            int b ;
            for(int i = 0; i < n; i++){
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            }
            for(int i = 0; i < w; i++){
                System.out.println(x[i]);
            }
        }catch(IOException e){

        } catch(IOException e){

        } IOException e {

        } {
            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());
            int[] x = new int[w];
            for(int i = 0; i< w; i++){
                x[i] = i + 1;
            }
            int a ;
            int b ;
            for(int i = 0; i < n; i++){
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            }
            for(int i = 0; i < w; i++){
                System.out.println(x[i]);
            }
        } int w = Integer.parseInt(reader.readLine()); w Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int n = Integer.parseInt(reader.readLine()); n Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int[] x = new int[w]; x new int[w] w for(int i = 0; i< w; i++){
                x[i] = i + 1;
            } int i = 0; int i = 0; i 0 i< w i w i++ i++ i {
                x[i] = i + 1;
            } {
                x[i] = i + 1;
            } x[i] = i + 1 x[i] x i i + 1 i 1 int a ; a int b ; b for(int i = 0; i < n; i++){
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            } {
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            } String line = reader.readLine(); line reader.readLine() reader.readLine reader String[] s = line.split(","); s line.split(",") line.split line "," a = Integer.parseInt(s[0]) a Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 b = Integer.parseInt(s[1]) b Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 int temp = x[a-1]; temp x[a-1] x a-1 a 1 x[a-1] = x[b-1] x[a-1] x a-1 a 1 x[b-1] x b-1 b 1 x[b-1] = temp x[b-1] x b-1 b 1 temp for(int i = 0; i < w; i++){
                System.out.println(x[i]);
            } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
                System.out.println(x[i]);
            } {
                System.out.println(x[i]);
            } System.out.println(x[i]) System.out.println System.out System System.out x[i] x i String[] args args public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());
            int[] x = new int[w];
            for(int i = 0; i< w; i++){
                x[i] = i + 1;
            }
            int a ;
            int b ;
            for(int i = 0; i < n; i++){
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            }
            for(int i = 0; i < w; i++){
                System.out.println(x[i]);
            }
        }catch(IOException e){

        }
    }
} public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());
            int[] x = new int[w];
            for(int i = 0; i< w; i++){
                x[i] = i + 1;
            }
            int a ;
            int b ;
            for(int i = 0; i < n; i++){
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            }
            for(int i = 0; i < w; i++){
                System.out.println(x[i]);
            }
        }catch(IOException e){

        }
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());
            int[] x = new int[w];
            for(int i = 0; i< w; i++){
                x[i] = i + 1;
            }
            int a ;
            int b ;
            for(int i = 0; i < n; i++){
                String line = reader.readLine();
                String[] s = line.split(",");
                a = Integer.parseInt(s[0]);
                b = Integer.parseInt(s[1]);
                int temp = x[a-1];
                x[a-1] = x[b-1];
                x[b-1] = temp;
            }
            for(int i = 0; i < w; i++){
                System.out.println(x[i]);
            }
        }catch(IOException e){

        }
    }
}
