import java.util.Scanner;

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

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