import java.util.*;

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

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