import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import static java.util.Collections.swap;

/**
 * Wrong Answer
 */
class Main {
	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);

		int w = in.nextInt();
		int n = in.nextInt();

		List<Integer> ans = new ArrayList<Integer>();
		for(int i=1;i<=w;i++) {
			ans.add(i);
		}

		String buf = in.nextLine();

		for(int i=0;i<n;i++) {
			String line = in.nextLine();
			String arr[] = line.split(",");
			int a = Integer.parseInt(arr[0]);
			int b = Integer.parseInt(arr[1]);
			swap(ans, a-1, b-1);
		}
		for(int i=0;i<ans.size();i++) {
			System.out.println(ans.get(i));
		}
	}
} import java.io.IOException; IOException java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util import static java.util.Collections.swap; import static java.util.Collections.swap; import static java.util.Collections.swap; class Main {
	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);

		int w = in.nextInt();
		int n = in.nextInt();

		List<Integer> ans = new ArrayList<Integer>();
		for(int i=1;i<=w;i++) {
			ans.add(i);
		}

		String buf = in.nextLine();

		for(int i=0;i<n;i++) {
			String line = in.nextLine();
			String arr[] = line.split(",");
			int a = Integer.parseInt(arr[0]);
			int b = Integer.parseInt(arr[1]);
			swap(ans, a-1, b-1);
		}
		for(int i=0;i<ans.size();i++) {
			System.out.println(ans.get(i));
		}
	}
} Main public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);

		int w = in.nextInt();
		int n = in.nextInt();

		List<Integer> ans = new ArrayList<Integer>();
		for(int i=1;i<=w;i++) {
			ans.add(i);
		}

		String buf = in.nextLine();

		for(int i=0;i<n;i++) {
			String line = in.nextLine();
			String arr[] = line.split(",");
			int a = Integer.parseInt(arr[0]);
			int b = Integer.parseInt(arr[1]);
			swap(ans, a-1, b-1);
		}
		for(int i=0;i<ans.size();i++) {
			System.out.println(ans.get(i));
		}
	} main {
		Scanner in = new Scanner(System.in);

		int w = in.nextInt();
		int n = in.nextInt();

		List<Integer> ans = new ArrayList<Integer>();
		for(int i=1;i<=w;i++) {
			ans.add(i);
		}

		String buf = in.nextLine();

		for(int i=0;i<n;i++) {
			String line = in.nextLine();
			String arr[] = line.split(",");
			int a = Integer.parseInt(arr[0]);
			int b = Integer.parseInt(arr[1]);
			swap(ans, a-1, b-1);
		}
		for(int i=0;i<ans.size();i++) {
			System.out.println(ans.get(i));
		}
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int w = in.nextInt(); w in.nextInt() in.nextInt in int n = in.nextInt(); n in.nextInt() in.nextInt in List<Integer> ans = new ArrayList<Integer>(); ans new ArrayList<Integer>() for(int i=1;i<=w;i++) {
			ans.add(i);
		} int i=1; int i=1; i 1 i<=w i w i++ i++ i {
			ans.add(i);
		} {
			ans.add(i);
		} ans.add(i) ans.add ans i String buf = in.nextLine(); buf in.nextLine() in.nextLine in for(int i=0;i<n;i++) {
			String line = in.nextLine();
			String arr[] = line.split(",");
			int a = Integer.parseInt(arr[0]);
			int b = Integer.parseInt(arr[1]);
			swap(ans, a-1, b-1);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String line = in.nextLine();
			String arr[] = line.split(",");
			int a = Integer.parseInt(arr[0]);
			int b = Integer.parseInt(arr[1]);
			swap(ans, a-1, b-1);
		} {
			String line = in.nextLine();
			String arr[] = line.split(",");
			int a = Integer.parseInt(arr[0]);
			int b = Integer.parseInt(arr[1]);
			swap(ans, a-1, b-1);
		} String line = in.nextLine(); line in.nextLine() in.nextLine in String arr[] = line.split(","); arr line.split(",") line.split line "," int a = Integer.parseInt(arr[0]); a Integer.parseInt(arr[0]) Integer.parseInt Integer arr[0] arr 0 int b = Integer.parseInt(arr[1]); b Integer.parseInt(arr[1]) Integer.parseInt Integer arr[1] arr 1 swap(ans, a-1, b-1) swap ans a-1 a 1 b-1 b 1 for(int i=0;i<ans.size();i++) {
			System.out.println(ans.get(i));
		} int i=0; int i=0; i 0 i<ans.size() i ans.size() ans.size ans i++ i++ i {
			System.out.println(ans.get(i));
		} {
			System.out.println(ans.get(i));
		} System.out.println(ans.get(i)) System.out.println System.out System System.out ans.get(i) ans.get ans i String[] args args
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import static java.util.Collections.swap;

/**
 * Wrong Answer
 */
class Main {
	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);

		int w = in.nextInt();
		int n = in.nextInt();

		List<Integer> ans = new ArrayList<Integer>();
		for(int i=1;i<=w;i++) {
			ans.add(i);
		}

		String buf = in.nextLine();

		for(int i=0;i<n;i++) {
			String line = in.nextLine();
			String arr[] = line.split(",");
			int a = Integer.parseInt(arr[0]);
			int b = Integer.parseInt(arr[1]);
			swap(ans, a-1, b-1);
		}
		for(int i=0;i<ans.size();i++) {
			System.out.println(ans.get(i));
		}
	}
}