import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt(), n = sc.nextInt();
        int[] num = new int[w];
        for (int i=0; i<w; i++) num[i] = i+1;

        int a, b, tmp;
        String s;
        for (int i=0; i<n; i++) {
            s = sc.next();
            a = Integer.parseInt(s.split(",")[0]) - 1;
            b = Integer.parseInt(s.split(",")[1]) - 1;
            tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }

        for (int i : num) System.out.println(i);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt(), n = sc.nextInt();
        int[] num = new int[w];
        for (int i=0; i<w; i++) num[i] = i+1;

        int a, b, tmp;
        String s;
        for (int i=0; i<n; i++) {
            s = sc.next();
            a = Integer.parseInt(s.split(",")[0]) - 1;
            b = Integer.parseInt(s.split(",")[1]) - 1;
            tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }

        for (int i : num) System.out.println(i);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt(), n = sc.nextInt();
        int[] num = new int[w];
        for (int i=0; i<w; i++) num[i] = i+1;

        int a, b, tmp;
        String s;
        for (int i=0; i<n; i++) {
            s = sc.next();
            a = Integer.parseInt(s.split(",")[0]) - 1;
            b = Integer.parseInt(s.split(",")[1]) - 1;
            tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }

        for (int i : num) System.out.println(i);
    } main {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt(), n = sc.nextInt();
        int[] num = new int[w];
        for (int i=0; i<w; i++) num[i] = i+1;

        int a, b, tmp;
        String s;
        for (int i=0; i<n; i++) {
            s = sc.next();
            a = Integer.parseInt(s.split(",")[0]) - 1;
            b = Integer.parseInt(s.split(",")[1]) - 1;
            tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }

        for (int i : num) System.out.println(i);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt() w sc.nextInt() sc.nextInt sc n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] num = new int[w]; num new int[w] w for (int i=0; i<w; i++) num[i] = i+1; int i=0; int i=0; i 0 i<w i w i++ i++ i num[i] = i+1; num[i] = i+1 num[i] num i i+1 i 1 int a a b b tmp; tmp String s; s for (int i=0; i<n; i++) {
            s = sc.next();
            a = Integer.parseInt(s.split(",")[0]) - 1;
            b = Integer.parseInt(s.split(",")[1]) - 1;
            tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            s = sc.next();
            a = Integer.parseInt(s.split(",")[0]) - 1;
            b = Integer.parseInt(s.split(",")[1]) - 1;
            tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        } {
            s = sc.next();
            a = Integer.parseInt(s.split(",")[0]) - 1;
            b = Integer.parseInt(s.split(",")[1]) - 1;
            tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        } s = sc.next() s sc.next() sc.next sc a = Integer.parseInt(s.split(",")[0]) - 1 a Integer.parseInt(s.split(",")[0]) - 1 Integer.parseInt(s.split(",")[0]) Integer.parseInt Integer s.split(",")[0] s.split(",") s.split s "," 0 1 b = Integer.parseInt(s.split(",")[1]) - 1 b Integer.parseInt(s.split(",")[1]) - 1 Integer.parseInt(s.split(",")[1]) Integer.parseInt Integer s.split(",")[1] s.split(",") s.split s "," 1 1 tmp = num[a] tmp num[a] num a num[a] = num[b] num[a] num a num[b] num b num[b] = tmp num[b] num b tmp for (int i : num) System.out.println(i); int i num System.out.println(i); System.out.println(i) System.out.println System.out System System.out i String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt(), n = sc.nextInt();
        int[] num = new int[w];
        for (int i=0; i<w; i++) num[i] = i+1;

        int a, b, tmp;
        String s;
        for (int i=0; i<n; i++) {
            s = sc.next();
            a = Integer.parseInt(s.split(",")[0]) - 1;
            b = Integer.parseInt(s.split(",")[1]) - 1;
            tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }

        for (int i : num) System.out.println(i);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt(), n = sc.nextInt();
        int[] num = new int[w];
        for (int i=0; i<w; i++) num[i] = i+1;

        int a, b, tmp;
        String s;
        for (int i=0; i<n; i++) {
            s = sc.next();
            a = Integer.parseInt(s.split(",")[0]) - 1;
            b = Integer.parseInt(s.split(",")[1]) - 1;
            tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }

        for (int i : num) System.out.println(i);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt(), n = sc.nextInt();
        int[] num = new int[w];
        for (int i=0; i<w; i++) num[i] = i+1;

        int a, b, tmp;
        String s;
        for (int i=0; i<n; i++) {
            s = sc.next();
            a = Integer.parseInt(s.split(",")[0]) - 1;
            b = Integer.parseInt(s.split(",")[1]) - 1;
            tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }

        for (int i : num) System.out.println(i);
    }
}