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;
    }
 
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz