import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 * @throws IOException
	 * @throws NumberFormatException
	 */
	public static void main(String[] args) throws NumberFormatException,
			IOException {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		//System.out.println("???????????°:");
		int tateLine = sc.nextInt();
		// System.out.println("?¨?????????°:");
		int yokoLine = sc.nextInt();
		int[] numList = new int[tateLine]; // ??????????????¨????????????????????????
		for (int i = 0; i < tateLine; i++) {
			numList[i] = i + 1;
		}
		int[][] yoko = new int[yokoLine][2]; // ?¨????????§??????¨???????????????????????????????´?
		for (int i = 0; i < yokoLine; i++) {
			// ??????????????????????????§????????????
			String[] s = sc.next().split(",");

			// System.out.println("????????¨");
			yoko[i][0] = Integer.parseInt(s[0]) - 1;
			// System.out.println("??????");
			yoko[i][1] = Integer.parseInt(s[1]) - 1;

		}

		for (int i = 0; i < yokoLine; i++) {
			int b = numList[yoko[i][0]];
			numList[yoko[i][0]] = numList[yoko[i][1]];
			numList[yoko[i][1]] = b;
		}

		for (int i = 0; i < tateLine; i++) {
			System.out.println(numList[i]);
		}
	}

}
/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