
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		StringTokenizer tokenizer;
		int a = Integer.parseInt(reader.readLine());
		int n = Integer.parseInt(reader.readLine());
		int[] nums = new int[a];
		for (int i = 0; i < a; i++) {
			nums[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			tokenizer = new StringTokenizer(reader.readLine(), ",");
			int x = Integer.parseInt(tokenizer.nextToken()) - 1;
			int y = Integer.parseInt(tokenizer.nextToken()) - 1;
			int tmp = nums[x];
			nums[x] = nums[y];
			nums[y] = tmp;
		}
		for (int i = 0; i < a; i++) {
			builder.append(nums[i]).append('\n');
		}
		System.out.print(builder);

	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		StringTokenizer tokenizer;
		int a = Integer.parseInt(reader.readLine());
		int n = Integer.parseInt(reader.readLine());
		int[] nums = new int[a];
		for (int i = 0; i < a; i++) {
			nums[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			tokenizer = new StringTokenizer(reader.readLine(), ",");
			int x = Integer.parseInt(tokenizer.nextToken()) - 1;
			int y = Integer.parseInt(tokenizer.nextToken()) - 1;
			int tmp = nums[x];
			nums[x] = nums[y];
			nums[y] = tmp;
		}
		for (int i = 0; i < a; i++) {
			builder.append(nums[i]).append('\n');
		}
		System.out.print(builder);

	}

} Main public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		StringTokenizer tokenizer;
		int a = Integer.parseInt(reader.readLine());
		int n = Integer.parseInt(reader.readLine());
		int[] nums = new int[a];
		for (int i = 0; i < a; i++) {
			nums[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			tokenizer = new StringTokenizer(reader.readLine(), ",");
			int x = Integer.parseInt(tokenizer.nextToken()) - 1;
			int y = Integer.parseInt(tokenizer.nextToken()) - 1;
			int tmp = nums[x];
			nums[x] = nums[y];
			nums[y] = tmp;
		}
		for (int i = 0; i < a; i++) {
			builder.append(nums[i]).append('\n');
		}
		System.out.print(builder);

	} main {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		StringTokenizer tokenizer;
		int a = Integer.parseInt(reader.readLine());
		int n = Integer.parseInt(reader.readLine());
		int[] nums = new int[a];
		for (int i = 0; i < a; i++) {
			nums[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			tokenizer = new StringTokenizer(reader.readLine(), ",");
			int x = Integer.parseInt(tokenizer.nextToken()) - 1;
			int y = Integer.parseInt(tokenizer.nextToken()) - 1;
			int tmp = nums[x];
			nums[x] = nums[y];
			nums[y] = tmp;
		}
		for (int i = 0; i < a; i++) {
			builder.append(nums[i]).append('\n');
		}
		System.out.print(builder);

	} BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in)); reader new BufferedReader(new InputStreamReader(
				System.in)) StringBuilder builder = new StringBuilder(); builder new StringBuilder() StringTokenizer tokenizer; tokenizer int a = Integer.parseInt(reader.readLine()); a Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int n = Integer.parseInt(reader.readLine()); n Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int[] nums = new int[a]; nums new int[a] a for (int i = 0; i < a; i++) {
			nums[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
			nums[i] = i + 1;
		} {
			nums[i] = i + 1;
		} nums[i] = i + 1 nums[i] nums i i + 1 i 1 for (int i = 0; i < n; i++) {
			tokenizer = new StringTokenizer(reader.readLine(), ",");
			int x = Integer.parseInt(tokenizer.nextToken()) - 1;
			int y = Integer.parseInt(tokenizer.nextToken()) - 1;
			int tmp = nums[x];
			nums[x] = nums[y];
			nums[y] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			tokenizer = new StringTokenizer(reader.readLine(), ",");
			int x = Integer.parseInt(tokenizer.nextToken()) - 1;
			int y = Integer.parseInt(tokenizer.nextToken()) - 1;
			int tmp = nums[x];
			nums[x] = nums[y];
			nums[y] = tmp;
		} {
			tokenizer = new StringTokenizer(reader.readLine(), ",");
			int x = Integer.parseInt(tokenizer.nextToken()) - 1;
			int y = Integer.parseInt(tokenizer.nextToken()) - 1;
			int tmp = nums[x];
			nums[x] = nums[y];
			nums[y] = tmp;
		} tokenizer = new StringTokenizer(reader.readLine(), ",") tokenizer new StringTokenizer(reader.readLine(), ",") int x = Integer.parseInt(tokenizer.nextToken()) - 1; x Integer.parseInt(tokenizer.nextToken()) - 1 Integer.parseInt(tokenizer.nextToken()) Integer.parseInt Integer tokenizer.nextToken() tokenizer.nextToken tokenizer 1 int y = Integer.parseInt(tokenizer.nextToken()) - 1; y Integer.parseInt(tokenizer.nextToken()) - 1 Integer.parseInt(tokenizer.nextToken()) Integer.parseInt Integer tokenizer.nextToken() tokenizer.nextToken tokenizer 1 int tmp = nums[x]; tmp nums[x] nums x nums[x] = nums[y] nums[x] nums x nums[y] nums y nums[y] = tmp nums[y] nums y tmp for (int i = 0; i < a; i++) {
			builder.append(nums[i]).append('\n');
		} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
			builder.append(nums[i]).append('\n');
		} {
			builder.append(nums[i]).append('\n');
		} builder.append(nums[i]).append('\n') builder.append(nums[i]).append builder.append(nums[i]) builder.append builder nums[i] nums i '\n' System.out.print(builder) System.out.print System.out System System.out builder String[] args args public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		StringTokenizer tokenizer;
		int a = Integer.parseInt(reader.readLine());
		int n = Integer.parseInt(reader.readLine());
		int[] nums = new int[a];
		for (int i = 0; i < a; i++) {
			nums[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			tokenizer = new StringTokenizer(reader.readLine(), ",");
			int x = Integer.parseInt(tokenizer.nextToken()) - 1;
			int y = Integer.parseInt(tokenizer.nextToken()) - 1;
			int tmp = nums[x];
			nums[x] = nums[y];
			nums[y] = tmp;
		}
		for (int i = 0; i < a; i++) {
			builder.append(nums[i]).append('\n');
		}
		System.out.print(builder);

	}

} public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		StringTokenizer tokenizer;
		int a = Integer.parseInt(reader.readLine());
		int n = Integer.parseInt(reader.readLine());
		int[] nums = new int[a];
		for (int i = 0; i < a; i++) {
			nums[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			tokenizer = new StringTokenizer(reader.readLine(), ",");
			int x = Integer.parseInt(tokenizer.nextToken()) - 1;
			int y = Integer.parseInt(tokenizer.nextToken()) - 1;
			int tmp = nums[x];
			nums[x] = nums[y];
			nums[y] = tmp;
		}
		for (int i = 0; i < a; i++) {
			builder.append(nums[i]).append('\n');
		}
		System.out.print(builder);

	}

} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		StringTokenizer tokenizer;
		int a = Integer.parseInt(reader.readLine());
		int n = Integer.parseInt(reader.readLine());
		int[] nums = new int[a];
		for (int i = 0; i < a; i++) {
			nums[i] = i + 1;
		}
		for (int i = 0; i < n; i++) {
			tokenizer = new StringTokenizer(reader.readLine(), ",");
			int x = Integer.parseInt(tokenizer.nextToken()) - 1;
			int y = Integer.parseInt(tokenizer.nextToken()) - 1;
			int tmp = nums[x];
			nums[x] = nums[y];
			nums[y] = tmp;
		}
		for (int i = 0; i < a; i++) {
			builder.append(nums[i]).append('\n');
		}
		System.out.print(builder);

	}

}