import java.util.Scanner;

public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		int w = Integer.parseInt(input());
		int[] amida = new int[w];

		for (int i = 0; i < w; i++) {

			amida[i] = i + 1;

		}

		int n = Integer.parseInt(input());

		for (int j = 0; j < n; j++) {

			String[] change = input().split(",");
			int temp = amida[Integer.parseInt(change[0]) - 1];
			amida[Integer.parseInt(change[0]) - 1] = amida[Integer.parseInt(change[1]) - 1];
			amida[Integer.parseInt(change[1]) - 1] = temp;

		}

		for (int k: amida) {

			System.out.println(k);

		}

		close();

	}

	public static String input() {

		return scanner.nextLine();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		int w = Integer.parseInt(input());
		int[] amida = new int[w];

		for (int i = 0; i < w; i++) {

			amida[i] = i + 1;

		}

		int n = Integer.parseInt(input());

		for (int j = 0; j < n; j++) {

			String[] change = input().split(",");
			int temp = amida[Integer.parseInt(change[0]) - 1];
			amida[Integer.parseInt(change[0]) - 1] = amida[Integer.parseInt(change[1]) - 1];
			amida[Integer.parseInt(change[1]) - 1] = temp;

		}

		for (int k: amida) {

			System.out.println(k);

		}

		close();

	}

	public static String input() {

		return scanner.nextLine();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
} Main public static Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) public static void main(String[] args) {

		int w = Integer.parseInt(input());
		int[] amida = new int[w];

		for (int i = 0; i < w; i++) {

			amida[i] = i + 1;

		}

		int n = Integer.parseInt(input());

		for (int j = 0; j < n; j++) {

			String[] change = input().split(",");
			int temp = amida[Integer.parseInt(change[0]) - 1];
			amida[Integer.parseInt(change[0]) - 1] = amida[Integer.parseInt(change[1]) - 1];
			amida[Integer.parseInt(change[1]) - 1] = temp;

		}

		for (int k: amida) {

			System.out.println(k);

		}

		close();

	} main {

		int w = Integer.parseInt(input());
		int[] amida = new int[w];

		for (int i = 0; i < w; i++) {

			amida[i] = i + 1;

		}

		int n = Integer.parseInt(input());

		for (int j = 0; j < n; j++) {

			String[] change = input().split(",");
			int temp = amida[Integer.parseInt(change[0]) - 1];
			amida[Integer.parseInt(change[0]) - 1] = amida[Integer.parseInt(change[1]) - 1];
			amida[Integer.parseInt(change[1]) - 1] = temp;

		}

		for (int k: amida) {

			System.out.println(k);

		}

		close();

	} int w = Integer.parseInt(input()); w Integer.parseInt(input()) Integer.parseInt Integer input() input int[] amida = new int[w]; amida new int[w] w for (int i = 0; i < w; i++) {

			amida[i] = i + 1;

		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {

			amida[i] = i + 1;

		} {

			amida[i] = i + 1;

		} amida[i] = i + 1 amida[i] amida i i + 1 i 1 int n = Integer.parseInt(input()); n Integer.parseInt(input()) Integer.parseInt Integer input() input for (int j = 0; j < n; j++) {

			String[] change = input().split(",");
			int temp = amida[Integer.parseInt(change[0]) - 1];
			amida[Integer.parseInt(change[0]) - 1] = amida[Integer.parseInt(change[1]) - 1];
			amida[Integer.parseInt(change[1]) - 1] = temp;

		} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {

			String[] change = input().split(",");
			int temp = amida[Integer.parseInt(change[0]) - 1];
			amida[Integer.parseInt(change[0]) - 1] = amida[Integer.parseInt(change[1]) - 1];
			amida[Integer.parseInt(change[1]) - 1] = temp;

		} {

			String[] change = input().split(",");
			int temp = amida[Integer.parseInt(change[0]) - 1];
			amida[Integer.parseInt(change[0]) - 1] = amida[Integer.parseInt(change[1]) - 1];
			amida[Integer.parseInt(change[1]) - 1] = temp;

		} String[] change = input().split(","); change input().split(",") input().split input() input "," int temp = amida[Integer.parseInt(change[0]) - 1]; temp amida[Integer.parseInt(change[0]) - 1] amida Integer.parseInt(change[0]) - 1 Integer.parseInt(change[0]) Integer.parseInt Integer change[0] change 0 1 amida[Integer.parseInt(change[0]) - 1] = amida[Integer.parseInt(change[1]) - 1] amida[Integer.parseInt(change[0]) - 1] amida Integer.parseInt(change[0]) - 1 Integer.parseInt(change[0]) Integer.parseInt Integer change[0] change 0 1 amida[Integer.parseInt(change[1]) - 1] amida Integer.parseInt(change[1]) - 1 Integer.parseInt(change[1]) Integer.parseInt Integer change[1] change 1 1 amida[Integer.parseInt(change[1]) - 1] = temp amida[Integer.parseInt(change[1]) - 1] amida Integer.parseInt(change[1]) - 1 Integer.parseInt(change[1]) Integer.parseInt Integer change[1] change 1 1 temp for (int k: amida) {

			System.out.println(k);

		} int k amida {

			System.out.println(k);

		} {

			System.out.println(k);

		} System.out.println(k) System.out.println System.out System System.out k close() close String[] args args public static String input() {

		return scanner.nextLine();

	} input {

		return scanner.nextLine();

	} return scanner.nextLine(); scanner.nextLine() scanner.nextLine scanner public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	} close {

		if (scanner != null) {

			scanner.close();

		}
	} if (scanner != null) {

			scanner.close();

		} scanner != null scanner null {

			scanner.close();

		} scanner.close() scanner.close scanner public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		int w = Integer.parseInt(input());
		int[] amida = new int[w];

		for (int i = 0; i < w; i++) {

			amida[i] = i + 1;

		}

		int n = Integer.parseInt(input());

		for (int j = 0; j < n; j++) {

			String[] change = input().split(",");
			int temp = amida[Integer.parseInt(change[0]) - 1];
			amida[Integer.parseInt(change[0]) - 1] = amida[Integer.parseInt(change[1]) - 1];
			amida[Integer.parseInt(change[1]) - 1] = temp;

		}

		for (int k: amida) {

			System.out.println(k);

		}

		close();

	}

	public static String input() {

		return scanner.nextLine();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
} public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		int w = Integer.parseInt(input());
		int[] amida = new int[w];

		for (int i = 0; i < w; i++) {

			amida[i] = i + 1;

		}

		int n = Integer.parseInt(input());

		for (int j = 0; j < n; j++) {

			String[] change = input().split(",");
			int temp = amida[Integer.parseInt(change[0]) - 1];
			amida[Integer.parseInt(change[0]) - 1] = amida[Integer.parseInt(change[1]) - 1];
			amida[Integer.parseInt(change[1]) - 1] = temp;

		}

		for (int k: amida) {

			System.out.println(k);

		}

		close();

	}

	public static String input() {

		return scanner.nextLine();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		int w = Integer.parseInt(input());
		int[] amida = new int[w];

		for (int i = 0; i < w; i++) {

			amida[i] = i + 1;

		}

		int n = Integer.parseInt(input());

		for (int j = 0; j < n; j++) {

			String[] change = input().split(",");
			int temp = amida[Integer.parseInt(change[0]) - 1];
			amida[Integer.parseInt(change[0]) - 1] = amida[Integer.parseInt(change[1]) - 1];
			amida[Integer.parseInt(change[1]) - 1] = temp;

		}

		for (int k: amida) {

			System.out.println(k);

		}

		close();

	}

	public static String input() {

		return scanner.nextLine();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
}