import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main {

	public static void main(String[] args) {

		// ストリームを作成する
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		int vertical = readNumber(reader);
		int horizontal = readNumber(reader);

		// 横棒リストを作る
		List<int[]> horizontalList = new ArrayList<int[]>();
		for (int i = 0; i < horizontal; i++) {
			horizontalList.add(readPair(reader));
		}

		// 縦棒を左から順番にシミュレートして結果を配列に保持する
		int[] goal = new int[vertical];
		for (int i = 1; i <= vertical; i++) {
			int result = i;
			for (int[] horizontalBar : horizontalList) {
				if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				}
			}
			goal[result - 1] = i;
		}

		// 結果を表示する
		for (int i : goal) {
			System.out.println(i);
		}

	}

	/**
	 * ストリームから1行読み込んで、数値として返す。
	 *
	 * @param reader
	 *            入力ストリーム
	 * @return 数値
	 */
	private static int readNumber(BufferedReader reader) {
		int result = 0;
		try {
			String line = reader.readLine();
			result = Integer.parseInt(line);
		} catch (IOException e) {
			throw new RuntimeException();
		}
		return result;
	}

	/**
	 * ストリームから1行読み込んで、数値のペアとして返す。
	 *
	 * @param reader
	 *            入力ストリーム
	 * @return 数値のペア
	 */
	private static int[] readPair(BufferedReader reader) {
		int[] result = new int[2];
		try {
			String line = reader.readLine();
			String[] array = line.split(",");
			result[0] = Integer.parseInt(array[0]);
			result[1] = Integer.parseInt(array[1]);
		} catch (IOException e) {
			throw new RuntimeException();
		}
		return result;
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util class Main {

	public static void main(String[] args) {

		// ストリームを作成する
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		int vertical = readNumber(reader);
		int horizontal = readNumber(reader);

		// 横棒リストを作る
		List<int[]> horizontalList = new ArrayList<int[]>();
		for (int i = 0; i < horizontal; i++) {
			horizontalList.add(readPair(reader));
		}

		// 縦棒を左から順番にシミュレートして結果を配列に保持する
		int[] goal = new int[vertical];
		for (int i = 1; i <= vertical; i++) {
			int result = i;
			for (int[] horizontalBar : horizontalList) {
				if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				}
			}
			goal[result - 1] = i;
		}

		// 結果を表示する
		for (int i : goal) {
			System.out.println(i);
		}

	}

	/**
	 * ストリームから1行読み込んで、数値として返す。
	 *
	 * @param reader
	 *            入力ストリーム
	 * @return 数値
	 */
	private static int readNumber(BufferedReader reader) {
		int result = 0;
		try {
			String line = reader.readLine();
			result = Integer.parseInt(line);
		} catch (IOException e) {
			throw new RuntimeException();
		}
		return result;
	}

	/**
	 * ストリームから1行読み込んで、数値のペアとして返す。
	 *
	 * @param reader
	 *            入力ストリーム
	 * @return 数値のペア
	 */
	private static int[] readPair(BufferedReader reader) {
		int[] result = new int[2];
		try {
			String line = reader.readLine();
			String[] array = line.split(",");
			result[0] = Integer.parseInt(array[0]);
			result[1] = Integer.parseInt(array[1]);
		} catch (IOException e) {
			throw new RuntimeException();
		}
		return result;
	}

} Main public static void main(String[] args) {

		// ストリームを作成する
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		int vertical = readNumber(reader);
		int horizontal = readNumber(reader);

		// 横棒リストを作る
		List<int[]> horizontalList = new ArrayList<int[]>();
		for (int i = 0; i < horizontal; i++) {
			horizontalList.add(readPair(reader));
		}

		// 縦棒を左から順番にシミュレートして結果を配列に保持する
		int[] goal = new int[vertical];
		for (int i = 1; i <= vertical; i++) {
			int result = i;
			for (int[] horizontalBar : horizontalList) {
				if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				}
			}
			goal[result - 1] = i;
		}

		// 結果を表示する
		for (int i : goal) {
			System.out.println(i);
		}

	} main {

		// ストリームを作成する
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		int vertical = readNumber(reader);
		int horizontal = readNumber(reader);

		// 横棒リストを作る
		List<int[]> horizontalList = new ArrayList<int[]>();
		for (int i = 0; i < horizontal; i++) {
			horizontalList.add(readPair(reader));
		}

		// 縦棒を左から順番にシミュレートして結果を配列に保持する
		int[] goal = new int[vertical];
		for (int i = 1; i <= vertical; i++) {
			int result = i;
			for (int[] horizontalBar : horizontalList) {
				if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				}
			}
			goal[result - 1] = i;
		}

		// 結果を表示する
		for (int i : goal) {
			System.out.println(i);
		}

	} BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in)); reader new BufferedReader(new InputStreamReader(
				System.in)) int vertical = readNumber(reader); vertical readNumber(reader) readNumber reader int horizontal = readNumber(reader); horizontal readNumber(reader) readNumber reader List<int[]> horizontalList = new ArrayList<int[]>(); horizontalList new ArrayList<int[]>() for (int i = 0; i < horizontal; i++) {
			horizontalList.add(readPair(reader));
		} int i = 0; int i = 0; i 0 i < horizontal i horizontal i++ i++ i {
			horizontalList.add(readPair(reader));
		} {
			horizontalList.add(readPair(reader));
		} horizontalList.add(readPair(reader)) horizontalList.add horizontalList readPair(reader) readPair reader int[] goal = new int[vertical]; goal new int[vertical] vertical for (int i = 1; i <= vertical; i++) {
			int result = i;
			for (int[] horizontalBar : horizontalList) {
				if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				}
			}
			goal[result - 1] = i;
		} int i = 1; int i = 1; i 1 i <= vertical i vertical i++ i++ i {
			int result = i;
			for (int[] horizontalBar : horizontalList) {
				if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				}
			}
			goal[result - 1] = i;
		} {
			int result = i;
			for (int[] horizontalBar : horizontalList) {
				if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				}
			}
			goal[result - 1] = i;
		} int result = i; result i for (int[] horizontalBar : horizontalList) {
				if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				}
			} int[] horizontalBar horizontalList {
				if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				}
			} {
				if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				}
			} if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				} result == horizontalBar[0] result horizontalBar[0] horizontalBar 0 {
					result = horizontalBar[1];
				} result = horizontalBar[1] result horizontalBar[1] horizontalBar 1 if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				} result == horizontalBar[1] result horizontalBar[1] horizontalBar 1 {
					result = horizontalBar[0];
				} result = horizontalBar[0] result horizontalBar[0] horizontalBar 0 goal[result - 1] = i goal[result - 1] goal result - 1 result 1 i for (int i : goal) {
			System.out.println(i);
		} int i goal {
			System.out.println(i);
		} {
			System.out.println(i);
		} System.out.println(i) System.out.println System.out System System.out i String[] args args /**
	 * ストリームから1行読み込んで、数値として返す。
	 *
	 * @param reader
	 *            入力ストリーム
	 * @return 数値
	 */
	private static int readNumber(BufferedReader reader) {
		int result = 0;
		try {
			String line = reader.readLine();
			result = Integer.parseInt(line);
		} catch (IOException e) {
			throw new RuntimeException();
		}
		return result;
	} readNumber {
		int result = 0;
		try {
			String line = reader.readLine();
			result = Integer.parseInt(line);
		} catch (IOException e) {
			throw new RuntimeException();
		}
		return result;
	} int result = 0; result 0 try {
			String line = reader.readLine();
			result = Integer.parseInt(line);
		} catch (IOException e) {
			throw new RuntimeException();
		} catch (IOException e) {
			throw new RuntimeException();
		} IOException e {
			throw new RuntimeException();
		} throw new RuntimeException(); new RuntimeException() {
			String line = reader.readLine();
			result = Integer.parseInt(line);
		} String line = reader.readLine(); line reader.readLine() reader.readLine reader result = Integer.parseInt(line) result Integer.parseInt(line) Integer.parseInt Integer line return result; result BufferedReader reader reader /**
	 * ストリームから1行読み込んで、数値のペアとして返す。
	 *
	 * @param reader
	 *            入力ストリーム
	 * @return 数値のペア
	 */
	private static int[] readPair(BufferedReader reader) {
		int[] result = new int[2];
		try {
			String line = reader.readLine();
			String[] array = line.split(",");
			result[0] = Integer.parseInt(array[0]);
			result[1] = Integer.parseInt(array[1]);
		} catch (IOException e) {
			throw new RuntimeException();
		}
		return result;
	} readPair {
		int[] result = new int[2];
		try {
			String line = reader.readLine();
			String[] array = line.split(",");
			result[0] = Integer.parseInt(array[0]);
			result[1] = Integer.parseInt(array[1]);
		} catch (IOException e) {
			throw new RuntimeException();
		}
		return result;
	} int[] result = new int[2]; result new int[2] 2 try {
			String line = reader.readLine();
			String[] array = line.split(",");
			result[0] = Integer.parseInt(array[0]);
			result[1] = Integer.parseInt(array[1]);
		} catch (IOException e) {
			throw new RuntimeException();
		} catch (IOException e) {
			throw new RuntimeException();
		} IOException e {
			throw new RuntimeException();
		} throw new RuntimeException(); new RuntimeException() {
			String line = reader.readLine();
			String[] array = line.split(",");
			result[0] = Integer.parseInt(array[0]);
			result[1] = Integer.parseInt(array[1]);
		} String line = reader.readLine(); line reader.readLine() reader.readLine reader String[] array = line.split(","); array line.split(",") line.split line "," result[0] = Integer.parseInt(array[0]) result[0] result 0 Integer.parseInt(array[0]) Integer.parseInt Integer array[0] array 0 result[1] = Integer.parseInt(array[1]) result[1] result 1 Integer.parseInt(array[1]) Integer.parseInt Integer array[1] array 1 return result; result BufferedReader reader reader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main {

	public static void main(String[] args) {

		// ストリームを作成する
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		int vertical = readNumber(reader);
		int horizontal = readNumber(reader);

		// 横棒リストを作る
		List<int[]> horizontalList = new ArrayList<int[]>();
		for (int i = 0; i < horizontal; i++) {
			horizontalList.add(readPair(reader));
		}

		// 縦棒を左から順番にシミュレートして結果を配列に保持する
		int[] goal = new int[vertical];
		for (int i = 1; i <= vertical; i++) {
			int result = i;
			for (int[] horizontalBar : horizontalList) {
				if (result == horizontalBar[0]) {
					result = horizontalBar[1];
				} else if (result == horizontalBar[1]) {
					result = horizontalBar[0];
				}
			}
			goal[result - 1] = i;
		}

		// 結果を表示する
		for (int i : goal) {
			System.out.println(i);
		}

	}

	/**
	 * ストリームから1行読み込んで、数値として返す。
	 *
	 * @param reader
	 *            入力ストリーム
	 * @return 数値
	 */
	private static int readNumber(BufferedReader reader) {
		int result = 0;
		try {
			String line = reader.readLine();
			result = Integer.parseInt(line);
		} catch (IOException e) {
			throw new RuntimeException();
		}
		return result;
	}

	/**
	 * ストリームから1行読み込んで、数値のペアとして返す。
	 *
	 * @param reader
	 *            入力ストリーム
	 * @return 数値のペア
	 */
	private static int[] readPair(BufferedReader reader) {
		int[] result = new int[2];
		try {
			String line = reader.readLine();
			String[] array = line.split(",");
			result[0] = Integer.parseInt(array[0]);
			result[1] = Integer.parseInt(array[1]);
		} catch (IOException e) {
			throw new RuntimeException();
		}
		return result;
	}

}