import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int row = sc.nextInt();
        int n = sc.nextInt();
        int save, x, y;
        int[] ans =  new int[row+1];
        for(int i=1; i<=row; i++) {
            ans[i] = i;
        }
        for(int i=0; i<n; i++) {
            String line = sc.next();
            String[] a = line.split(",");
            x = Integer.parseInt(a[0]);
            y = Integer.parseInt(a[1]);
            save = ans[x];
            ans[x] = ans[y];
            ans[y] = save;

        }
        for(int i=1; i<=row; i++) {
            System.out.println(ans[i]);
        }
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int row = sc.nextInt();
        int n = sc.nextInt();
        int save, x, y;
        int[] ans =  new int[row+1];
        for(int i=1; i<=row; i++) {
            ans[i] = i;
        }
        for(int i=0; i<n; i++) {
            String line = sc.next();
            String[] a = line.split(",");
            x = Integer.parseInt(a[0]);
            y = Integer.parseInt(a[1]);
            save = ans[x];
            ans[x] = ans[y];
            ans[y] = save;

        }
        for(int i=1; i<=row; i++) {
            System.out.println(ans[i]);
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int row = sc.nextInt();
        int n = sc.nextInt();
        int save, x, y;
        int[] ans =  new int[row+1];
        for(int i=1; i<=row; i++) {
            ans[i] = i;
        }
        for(int i=0; i<n; i++) {
            String line = sc.next();
            String[] a = line.split(",");
            x = Integer.parseInt(a[0]);
            y = Integer.parseInt(a[1]);
            save = ans[x];
            ans[x] = ans[y];
            ans[y] = save;

        }
        for(int i=1; i<=row; i++) {
            System.out.println(ans[i]);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int row = sc.nextInt();
        int n = sc.nextInt();
        int save, x, y;
        int[] ans =  new int[row+1];
        for(int i=1; i<=row; i++) {
            ans[i] = i;
        }
        for(int i=0; i<n; i++) {
            String line = sc.next();
            String[] a = line.split(",");
            x = Integer.parseInt(a[0]);
            y = Integer.parseInt(a[1]);
            save = ans[x];
            ans[x] = ans[y];
            ans[y] = save;

        }
        for(int i=1; i<=row; i++) {
            System.out.println(ans[i]);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int row = sc.nextInt(); row sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int save save x x y; y int[] ans =  new int[row+1]; ans new int[row+1] row+1 row 1 for(int i=1; i<=row; i++) {
            ans[i] = i;
        } int i=1; int i=1; i 1 i<=row i row i++ i++ i {
            ans[i] = i;
        } {
            ans[i] = i;
        } ans[i] = i ans[i] ans i i for(int i=0; i<n; i++) {
            String line = sc.next();
            String[] a = line.split(",");
            x = Integer.parseInt(a[0]);
            y = Integer.parseInt(a[1]);
            save = ans[x];
            ans[x] = ans[y];
            ans[y] = save;

        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            String line = sc.next();
            String[] a = line.split(",");
            x = Integer.parseInt(a[0]);
            y = Integer.parseInt(a[1]);
            save = ans[x];
            ans[x] = ans[y];
            ans[y] = save;

        } {
            String line = sc.next();
            String[] a = line.split(",");
            x = Integer.parseInt(a[0]);
            y = Integer.parseInt(a[1]);
            save = ans[x];
            ans[x] = ans[y];
            ans[y] = save;

        } String line = sc.next(); line sc.next() sc.next sc String[] a = line.split(","); a line.split(",") line.split line "," x = Integer.parseInt(a[0]) x Integer.parseInt(a[0]) Integer.parseInt Integer a[0] a 0 y = Integer.parseInt(a[1]) y Integer.parseInt(a[1]) Integer.parseInt Integer a[1] a 1 save = ans[x] save ans[x] ans x ans[x] = ans[y] ans[x] ans x ans[y] ans y ans[y] = save ans[y] ans y save for(int i=1; i<=row; i++) {
            System.out.println(ans[i]);
        } int i=1; int i=1; i 1 i<=row i row i++ i++ i {
            System.out.println(ans[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 public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int row = sc.nextInt();
        int n = sc.nextInt();
        int save, x, y;
        int[] ans =  new int[row+1];
        for(int i=1; i<=row; i++) {
            ans[i] = i;
        }
        for(int i=0; i<n; i++) {
            String line = sc.next();
            String[] a = line.split(",");
            x = Integer.parseInt(a[0]);
            y = Integer.parseInt(a[1]);
            save = ans[x];
            ans[x] = ans[y];
            ans[y] = save;

        }
        for(int i=1; i<=row; i++) {
            System.out.println(ans[i]);
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int row = sc.nextInt();
        int n = sc.nextInt();
        int save, x, y;
        int[] ans =  new int[row+1];
        for(int i=1; i<=row; i++) {
            ans[i] = i;
        }
        for(int i=0; i<n; i++) {
            String line = sc.next();
            String[] a = line.split(",");
            x = Integer.parseInt(a[0]);
            y = Integer.parseInt(a[1]);
            save = ans[x];
            ans[x] = ans[y];
            ans[y] = save;

        }
        for(int i=1; i<=row; i++) {
            System.out.println(ans[i]);
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int row = sc.nextInt();
        int n = sc.nextInt();
        int save, x, y;
        int[] ans =  new int[row+1];
        for(int i=1; i<=row; i++) {
            ans[i] = i;
        }
        for(int i=0; i<n; i++) {
            String line = sc.next();
            String[] a = line.split(",");
            x = Integer.parseInt(a[0]);
            y = Integer.parseInt(a[1]);
            save = ans[x];
            ans[x] = ans[y];
            ans[y] = save;

        }
        for(int i=1; i<=row; i++) {
            System.out.println(ans[i]);
        }
    }
}

