import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static void main(String[] args) throws IOException {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        // ?????£???????¬???°
        int vertical = 0;
        // ??¨???£???????¬???°
        int horizontal = 0;
        // ?????????????????????¨??????°
        int x = 0;


            vertical = Integer.parseInt(br.readLine());

            // ?????£???????????????????
            int[] drowingLots = new int[vertical];
            // ???????????£???????????????´???????
            for (int i = 0; i < vertical; ++i) {
                drowingLots[i] = i + 1;
            }
 
            // ??¨???£? 2??????
            horizontal = Integer.parseInt(br.readLine());
  
 
                // ??¨??????\?????????????????????????????????????????? 3????????\???
                for (int i = 0; i < horizontal; ++i) {
                    String input = br.readLine();
                    if (input == null || input.isEmpty()) {
                        break;
                    }
 
                    String[] change = input.split(",");
                    int[] intInput = adjustment(change);
 
                    // a1???????????????
                    x = drowingLots[intInput[0]];
                    // b1???a1?????\??????
                    drowingLots[intInput[0]] = drowingLots[intInput[1]];
                    // a1???b1?????\??????
                    drowingLots[intInput[1]] = x;
                }
 
                for (int output : drowingLots) {
                    System.out.println(output);
                }

  
    }
 
    // ??\??????????????????int??????????????????-1??????
    private static int[] adjustment(String[] strInput) {
        // int????????????????????????
        int[] intInput = new int[strInput.length];
 
        intInput[0] = Integer.parseInt(strInput[0]) - 1;
        intInput[1] = Integer.parseInt(strInput[1]) - 1;
 
        return intInput;
    }
 
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
 
    public static void main(String[] args) throws IOException {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        // ?????£???????¬???°
        int vertical = 0;
        // ??¨???£???????¬???°
        int horizontal = 0;
        // ?????????????????????¨??????°
        int x = 0;


            vertical = Integer.parseInt(br.readLine());

            // ?????£???????????????????
            int[] drowingLots = new int[vertical];
            // ???????????£???????????????´???????
            for (int i = 0; i < vertical; ++i) {
                drowingLots[i] = i + 1;
            }
 
            // ??¨???£? 2??????
            horizontal = Integer.parseInt(br.readLine());
  
 
                // ??¨??????\?????????????????????????????????????????? 3????????\???
                for (int i = 0; i < horizontal; ++i) {
                    String input = br.readLine();
                    if (input == null || input.isEmpty()) {
                        break;
                    }
 
                    String[] change = input.split(",");
                    int[] intInput = adjustment(change);
 
                    // a1???????????????
                    x = drowingLots[intInput[0]];
                    // b1???a1?????\??????
                    drowingLots[intInput[0]] = drowingLots[intInput[1]];
                    // a1???b1?????\??????
                    drowingLots[intInput[1]] = x;
                }
 
                for (int output : drowingLots) {
                    System.out.println(output);
                }

  
    }
 
    // ??\??????????????????int??????????????????-1??????
    private static int[] adjustment(String[] strInput) {
        // int????????????????????????
        int[] intInput = new int[strInput.length];
 
        intInput[0] = Integer.parseInt(strInput[0]) - 1;
        intInput[1] = Integer.parseInt(strInput[1]) - 1;
 
        return intInput;
    }
 
} Main public static void main(String[] args) throws IOException {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        // ?????£???????¬???°
        int vertical = 0;
        // ??¨???£???????¬???°
        int horizontal = 0;
        // ?????????????????????¨??????°
        int x = 0;


            vertical = Integer.parseInt(br.readLine());

            // ?????£???????????????????
            int[] drowingLots = new int[vertical];
            // ???????????£???????????????´???????
            for (int i = 0; i < vertical; ++i) {
                drowingLots[i] = i + 1;
            }
 
            // ??¨???£? 2??????
            horizontal = Integer.parseInt(br.readLine());
  
 
                // ??¨??????\?????????????????????????????????????????? 3????????\???
                for (int i = 0; i < horizontal; ++i) {
                    String input = br.readLine();
                    if (input == null || input.isEmpty()) {
                        break;
                    }
 
                    String[] change = input.split(",");
                    int[] intInput = adjustment(change);
 
                    // a1???????????????
                    x = drowingLots[intInput[0]];
                    // b1???a1?????\??????
                    drowingLots[intInput[0]] = drowingLots[intInput[1]];
                    // a1???b1?????\??????
                    drowingLots[intInput[1]] = x;
                }
 
                for (int output : drowingLots) {
                    System.out.println(output);
                }

  
    } main {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        // ?????£???????¬???°
        int vertical = 0;
        // ??¨???£???????¬???°
        int horizontal = 0;
        // ?????????????????????¨??????°
        int x = 0;


            vertical = Integer.parseInt(br.readLine());

            // ?????£???????????????????
            int[] drowingLots = new int[vertical];
            // ???????????£???????????????´???????
            for (int i = 0; i < vertical; ++i) {
                drowingLots[i] = i + 1;
            }
 
            // ??¨???£? 2??????
            horizontal = Integer.parseInt(br.readLine());
  
 
                // ??¨??????\?????????????????????????????????????????? 3????????\???
                for (int i = 0; i < horizontal; ++i) {
                    String input = br.readLine();
                    if (input == null || input.isEmpty()) {
                        break;
                    }
 
                    String[] change = input.split(",");
                    int[] intInput = adjustment(change);
 
                    // a1???????????????
                    x = drowingLots[intInput[0]];
                    // b1???a1?????\??????
                    drowingLots[intInput[0]] = drowingLots[intInput[1]];
                    // a1???b1?????\??????
                    drowingLots[intInput[1]] = x;
                }
 
                for (int output : drowingLots) {
                    System.out.println(output);
                }

  
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int vertical = 0; vertical 0 int horizontal = 0; horizontal 0 int x = 0; x 0 vertical = Integer.parseInt(br.readLine()) vertical Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] drowingLots = new int[vertical]; drowingLots new int[vertical] vertical for (int i = 0; i < vertical; ++i) {
                drowingLots[i] = i + 1;
            } int i = 0; int i = 0; i 0 i < vertical i vertical ++i ++i i {
                drowingLots[i] = i + 1;
            } {
                drowingLots[i] = i + 1;
            } drowingLots[i] = i + 1 drowingLots[i] drowingLots i i + 1 i 1 horizontal = Integer.parseInt(br.readLine()) horizontal Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for (int i = 0; i < horizontal; ++i) {
                    String input = br.readLine();
                    if (input == null || input.isEmpty()) {
                        break;
                    }
 
                    String[] change = input.split(",");
                    int[] intInput = adjustment(change);
 
                    // a1???????????????
                    x = drowingLots[intInput[0]];
                    // b1???a1?????\??????
                    drowingLots[intInput[0]] = drowingLots[intInput[1]];
                    // a1???b1?????\??????
                    drowingLots[intInput[1]] = x;
                } int i = 0; int i = 0; i 0 i < horizontal i horizontal ++i ++i i {
                    String input = br.readLine();
                    if (input == null || input.isEmpty()) {
                        break;
                    }
 
                    String[] change = input.split(",");
                    int[] intInput = adjustment(change);
 
                    // a1???????????????
                    x = drowingLots[intInput[0]];
                    // b1???a1?????\??????
                    drowingLots[intInput[0]] = drowingLots[intInput[1]];
                    // a1???b1?????\??????
                    drowingLots[intInput[1]] = x;
                } {
                    String input = br.readLine();
                    if (input == null || input.isEmpty()) {
                        break;
                    }
 
                    String[] change = input.split(",");
                    int[] intInput = adjustment(change);
 
                    // a1???????????????
                    x = drowingLots[intInput[0]];
                    // b1???a1?????\??????
                    drowingLots[intInput[0]] = drowingLots[intInput[1]];
                    // a1???b1?????\??????
                    drowingLots[intInput[1]] = x;
                } String input = br.readLine(); input br.readLine() br.readLine br if (input == null || input.isEmpty()) {
                        break;
                    } input == null || input.isEmpty() input == null input null input.isEmpty() input.isEmpty input {
                        break;
                    } break; String[] change = input.split(","); change input.split(",") input.split input "," int[] intInput = adjustment(change); intInput adjustment(change) adjustment change x = drowingLots[intInput[0]] x drowingLots[intInput[0]] drowingLots intInput[0] intInput 0 drowingLots[intInput[0]] = drowingLots[intInput[1]] drowingLots[intInput[0]] drowingLots intInput[0] intInput 0 drowingLots[intInput[1]] drowingLots intInput[1] intInput 1 drowingLots[intInput[1]] = x drowingLots[intInput[1]] drowingLots intInput[1] intInput 1 x for (int output : drowingLots) {
                    System.out.println(output);
                } int output drowingLots {
                    System.out.println(output);
                } {
                    System.out.println(output);
                } System.out.println(output) System.out.println System.out System System.out output String[] args args // ??\??????????????????int??????????????????-1??????
    private static int[] adjustment(String[] strInput) {
        // int????????????????????????
        int[] intInput = new int[strInput.length];
 
        intInput[0] = Integer.parseInt(strInput[0]) - 1;
        intInput[1] = Integer.parseInt(strInput[1]) - 1;
 
        return intInput;
    } adjustment {
        // int????????????????????????
        int[] intInput = new int[strInput.length];
 
        intInput[0] = Integer.parseInt(strInput[0]) - 1;
        intInput[1] = Integer.parseInt(strInput[1]) - 1;
 
        return intInput;
    } int[] intInput = new int[strInput.length]; intInput new int[strInput.length] strInput.length strInput strInput.length intInput[0] = Integer.parseInt(strInput[0]) - 1 intInput[0] intInput 0 Integer.parseInt(strInput[0]) - 1 Integer.parseInt(strInput[0]) Integer.parseInt Integer strInput[0] strInput 0 1 intInput[1] = Integer.parseInt(strInput[1]) - 1 intInput[1] intInput 1 Integer.parseInt(strInput[1]) - 1 Integer.parseInt(strInput[1]) Integer.parseInt Integer strInput[1] strInput 1 1 return intInput; intInput String[] strInput strInput public class Main {
 
    public static void main(String[] args) throws IOException {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        // ?????£???????¬???°
        int vertical = 0;
        // ??¨???£???????¬???°
        int horizontal = 0;
        // ?????????????????????¨??????°
        int x = 0;


            vertical = Integer.parseInt(br.readLine());

            // ?????£???????????????????
            int[] drowingLots = new int[vertical];
            // ???????????£???????????????´???????
            for (int i = 0; i < vertical; ++i) {
                drowingLots[i] = i + 1;
            }
 
            // ??¨???£? 2??????
            horizontal = Integer.parseInt(br.readLine());
  
 
                // ??¨??????\?????????????????????????????????????????? 3????????\???
                for (int i = 0; i < horizontal; ++i) {
                    String input = br.readLine();
                    if (input == null || input.isEmpty()) {
                        break;
                    }
 
                    String[] change = input.split(",");
                    int[] intInput = adjustment(change);
 
                    // a1???????????????
                    x = drowingLots[intInput[0]];
                    // b1???a1?????\??????
                    drowingLots[intInput[0]] = drowingLots[intInput[1]];
                    // a1???b1?????\??????
                    drowingLots[intInput[1]] = x;
                }
 
                for (int output : drowingLots) {
                    System.out.println(output);
                }

  
    }
 
    // ??\??????????????????int??????????????????-1??????
    private static int[] adjustment(String[] strInput) {
        // int????????????????????????
        int[] intInput = new int[strInput.length];
 
        intInput[0] = Integer.parseInt(strInput[0]) - 1;
        intInput[1] = Integer.parseInt(strInput[1]) - 1;
 
        return intInput;
    }
 
} public class Main {
 
    public static void main(String[] args) throws IOException {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        // ?????£???????¬???°
        int vertical = 0;
        // ??¨???£???????¬???°
        int horizontal = 0;
        // ?????????????????????¨??????°
        int x = 0;


            vertical = Integer.parseInt(br.readLine());

            // ?????£???????????????????
            int[] drowingLots = new int[vertical];
            // ???????????£???????????????´???????
            for (int i = 0; i < vertical; ++i) {
                drowingLots[i] = i + 1;
            }
 
            // ??¨???£? 2??????
            horizontal = Integer.parseInt(br.readLine());
  
 
                // ??¨??????\?????????????????????????????????????????? 3????????\???
                for (int i = 0; i < horizontal; ++i) {
                    String input = br.readLine();
                    if (input == null || input.isEmpty()) {
                        break;
                    }
 
                    String[] change = input.split(",");
                    int[] intInput = adjustment(change);
 
                    // a1???????????????
                    x = drowingLots[intInput[0]];
                    // b1???a1?????\??????
                    drowingLots[intInput[0]] = drowingLots[intInput[1]];
                    // a1???b1?????\??????
                    drowingLots[intInput[1]] = x;
                }
 
                for (int output : drowingLots) {
                    System.out.println(output);
                }

  
    }
 
    // ??\??????????????????int??????????????????-1??????
    private static int[] adjustment(String[] strInput) {
        // int????????????????????????
        int[] intInput = new int[strInput.length];
 
        intInput[0] = Integer.parseInt(strInput[0]) - 1;
        intInput[1] = Integer.parseInt(strInput[1]) - 1;
 
        return intInput;
    }
 
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static void main(String[] args) throws IOException {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        // ?????£???????¬???°
        int vertical = 0;
        // ??¨???£???????¬???°
        int horizontal = 0;
        // ?????????????????????¨??????°
        int x = 0;


            vertical = Integer.parseInt(br.readLine());

            // ?????£???????????????????
            int[] drowingLots = new int[vertical];
            // ???????????£???????????????´???????
            for (int i = 0; i < vertical; ++i) {
                drowingLots[i] = i + 1;
            }
 
            // ??¨???£? 2??????
            horizontal = Integer.parseInt(br.readLine());
  
 
                // ??¨??????\?????????????????????????????????????????? 3????????\???
                for (int i = 0; i < horizontal; ++i) {
                    String input = br.readLine();
                    if (input == null || input.isEmpty()) {
                        break;
                    }
 
                    String[] change = input.split(",");
                    int[] intInput = adjustment(change);
 
                    // a1???????????????
                    x = drowingLots[intInput[0]];
                    // b1???a1?????\??????
                    drowingLots[intInput[0]] = drowingLots[intInput[1]];
                    // a1???b1?????\??????
                    drowingLots[intInput[1]] = x;
                }
 
                for (int output : drowingLots) {
                    System.out.println(output);
                }

  
    }
 
    // ??\??????????????????int??????????????????-1??????
    private static int[] adjustment(String[] strInput) {
        // int????????????????????????
        int[] intInput = new int[strInput.length];
 
        intInput[0] = Integer.parseInt(strInput[0]) - 1;
        intInput[1] = Integer.parseInt(strInput[1]) - 1;
 
        return intInput;
    }
 
}