import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            int w = Integer.parseInt(br.readLine());
            int[] x = new int[w+1];
            for (int i = 0; i < w+1; i++) {
                x[i] = i;
            }
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            }
            for (int i = 1; i < w+1; i++) {
                System.out.println(x[i]);
            }
        } catch (Exception ex) {
            System.exit(0);
        }
    }
} import java.io.*; io.* java import java.math.BigInteger; BigInteger java.math import java.util.*; util.* java public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            int w = Integer.parseInt(br.readLine());
            int[] x = new int[w+1];
            for (int i = 0; i < w+1; i++) {
                x[i] = i;
            }
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            }
            for (int i = 1; i < w+1; i++) {
                System.out.println(x[i]);
            }
        } catch (Exception ex) {
            System.exit(0);
        }
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            int w = Integer.parseInt(br.readLine());
            int[] x = new int[w+1];
            for (int i = 0; i < w+1; i++) {
                x[i] = i;
            }
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            }
            for (int i = 1; i < w+1; i++) {
                System.out.println(x[i]);
            }
        } catch (Exception ex) {
            System.exit(0);
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            int w = Integer.parseInt(br.readLine());
            int[] x = new int[w+1];
            for (int i = 0; i < w+1; i++) {
                x[i] = i;
            }
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            }
            for (int i = 1; i < w+1; i++) {
                System.out.println(x[i]);
            }
        } catch (Exception ex) {
            System.exit(0);
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try {
            int w = Integer.parseInt(br.readLine());
            int[] x = new int[w+1];
            for (int i = 0; i < w+1; i++) {
                x[i] = i;
            }
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            }
            for (int i = 1; i < w+1; i++) {
                System.out.println(x[i]);
            }
        } catch (Exception ex) {
            System.exit(0);
        } catch (Exception ex) {
            System.exit(0);
        } Exception ex {
            System.exit(0);
        } System.exit(0) System.exit System 0 {
            int w = Integer.parseInt(br.readLine());
            int[] x = new int[w+1];
            for (int i = 0; i < w+1; i++) {
                x[i] = i;
            }
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            }
            for (int i = 1; i < w+1; i++) {
                System.out.println(x[i]);
            }
        } int w = Integer.parseInt(br.readLine()); w Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] x = new int[w+1]; x new int[w+1] w+1 w 1 for (int i = 0; i < w+1; i++) {
                x[i] = i;
            } int i = 0; int i = 0; i 0 i < w+1 i w+1 w 1 i++ i++ i {
                x[i] = i;
            } {
                x[i] = i;
            } x[i] = i x[i] x i i int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for (int i = 0; i < n; i++) {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            } {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            } String st = br.readLine(); st br.readLine() br.readLine br String[] s = st.split(",", 0); s st.split(",", 0) st.split st "," 0 int a = Integer.parseInt(s[0]); a Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int b = Integer.parseInt(s[1]); b Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 int sw = x[a]; sw x[a] x a x[a] = x[b] x[a] x a x[b] x b x[b] = sw x[b] x b sw for (int i = 1; i < w+1; i++) {
                System.out.println(x[i]);
            } int i = 1; int i = 1; i 1 i < w+1 i w+1 w 1 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) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            int w = Integer.parseInt(br.readLine());
            int[] x = new int[w+1];
            for (int i = 0; i < w+1; i++) {
                x[i] = i;
            }
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            }
            for (int i = 1; i < w+1; i++) {
                System.out.println(x[i]);
            }
        } catch (Exception ex) {
            System.exit(0);
        }
    }
} public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            int w = Integer.parseInt(br.readLine());
            int[] x = new int[w+1];
            for (int i = 0; i < w+1; i++) {
                x[i] = i;
            }
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            }
            for (int i = 1; i < w+1; i++) {
                System.out.println(x[i]);
            }
        } catch (Exception ex) {
            System.exit(0);
        }
    }
} Main
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            int w = Integer.parseInt(br.readLine());
            int[] x = new int[w+1];
            for (int i = 0; i < w+1; i++) {
                x[i] = i;
            }
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                String st = br.readLine();
                String[] s = st.split(",", 0);
                int a = Integer.parseInt(s[0]);
                int b = Integer.parseInt(s[1]);
                int sw = x[a];
                x[a] = x[b];
                x[b] = sw;
            }
            for (int i = 1; i < w+1; i++) {
                System.out.println(x[i]);
            }
        } catch (Exception ex) {
            System.exit(0);
        }
    }
}