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]);
		}
	}

} import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util 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]);
		}
	}

} 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]);
		}
	} main {
		// 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]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int tateLine = sc.nextInt(); tateLine sc.nextInt() sc.nextInt sc int yokoLine = sc.nextInt(); yokoLine sc.nextInt() sc.nextInt sc int[] numList = new int[tateLine]; numList new int[tateLine] tateLine for (int i = 0; i < tateLine; i++) {
			numList[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < tateLine i tateLine i++ i++ i {
			numList[i] = i + 1;
		} {
			numList[i] = i + 1;
		} numList[i] = i + 1 numList[i] numList i i + 1 i 1 int[][] yoko = new int[yokoLine][2]; yoko new int[yokoLine][2] 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;

		} int i = 0; int i = 0; i 0 i < yokoLine i yokoLine i++ i++ 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;

		} {
			// ??????????????????????????§????????????
			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;

		} String[] s = sc.next().split(","); s sc.next().split(",") sc.next().split sc.next() sc.next sc "," yoko[i][0] = Integer.parseInt(s[0]) - 1 yoko[i][0] yoko[i] yoko i 0 Integer.parseInt(s[0]) - 1 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 1 yoko[i][1] = Integer.parseInt(s[1]) - 1 yoko[i][1] yoko[i] yoko i 1 Integer.parseInt(s[1]) - 1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] 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;
		} int i = 0; int i = 0; i 0 i < yokoLine i yokoLine i++ i++ i {
			int b = numList[yoko[i][0]];
			numList[yoko[i][0]] = numList[yoko[i][1]];
			numList[yoko[i][1]] = b;
		} {
			int b = numList[yoko[i][0]];
			numList[yoko[i][0]] = numList[yoko[i][1]];
			numList[yoko[i][1]] = b;
		} int b = numList[yoko[i][0]]; b numList[yoko[i][0]] numList yoko[i][0] yoko[i] yoko i 0 numList[yoko[i][0]] = numList[yoko[i][1]] numList[yoko[i][0]] numList yoko[i][0] yoko[i] yoko i 0 numList[yoko[i][1]] numList yoko[i][1] yoko[i] yoko i 1 numList[yoko[i][1]] = b numList[yoko[i][1]] numList yoko[i][1] yoko[i] yoko i 1 b for (int i = 0; i < tateLine; i++) {
			System.out.println(numList[i]);
		} int i = 0; int i = 0; i 0 i < tateLine i tateLine i++ i++ i {
			System.out.println(numList[i]);
		} {
			System.out.println(numList[i]);
		} System.out.println(numList[i]) System.out.println System.out System System.out numList[i] numList i String[] args args 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]);
		}
	}

} 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]);
		}
	}

} Main
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]);
		}
	}

}