import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int w = si(), n = si();
		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
			ary[i]=i+1;
		for (int i = 0; i < n; i++) {
			String[] cons = scan.next().split(",");
			int p = Integer.parseInt(cons[0])-1, q = Integer.parseInt(cons[1])-1;
			int tmp = ary[p];
			ary[p] = ary[q];
			ary[q] = tmp;
		}
		for (int i = 0; i < w ; i++)
			out.println(ary[i]);
		out.flush();
	}

	static int si() {
		return Integer.parseInt(scan.next());
	}
} import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {

	static Scanner scan = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int w = si(), n = si();
		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
			ary[i]=i+1;
		for (int i = 0; i < n; i++) {
			String[] cons = scan.next().split(",");
			int p = Integer.parseInt(cons[0])-1, q = Integer.parseInt(cons[1])-1;
			int tmp = ary[p];
			ary[p] = ary[q];
			ary[q] = tmp;
		}
		for (int i = 0; i < w ; i++)
			out.println(ary[i]);
		out.flush();
	}

	static int si() {
		return Integer.parseInt(scan.next());
	}
} Main static Scanner scan = new Scanner(System.in); scan new Scanner(System.in) static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) public static void main(String[] args) {
		int w = si(), n = si();
		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
			ary[i]=i+1;
		for (int i = 0; i < n; i++) {
			String[] cons = scan.next().split(",");
			int p = Integer.parseInt(cons[0])-1, q = Integer.parseInt(cons[1])-1;
			int tmp = ary[p];
			ary[p] = ary[q];
			ary[q] = tmp;
		}
		for (int i = 0; i < w ; i++)
			out.println(ary[i]);
		out.flush();
	} main {
		int w = si(), n = si();
		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
			ary[i]=i+1;
		for (int i = 0; i < n; i++) {
			String[] cons = scan.next().split(",");
			int p = Integer.parseInt(cons[0])-1, q = Integer.parseInt(cons[1])-1;
			int tmp = ary[p];
			ary[p] = ary[q];
			ary[q] = tmp;
		}
		for (int i = 0; i < w ; i++)
			out.println(ary[i]);
		out.flush();
	} int w = si() w si() si n = si(); n si() si int[] ary = new int[w]; ary new int[w] w for (int i = 0; i < w; i++)
			ary[i]=i+1; int i = 0; int i = 0; i 0 i < w i w i++ i++ i ary[i]=i+1; ary[i]=i+1 ary[i] ary i i+1 i 1 for (int i = 0; i < n; i++) {
			String[] cons = scan.next().split(",");
			int p = Integer.parseInt(cons[0])-1, q = Integer.parseInt(cons[1])-1;
			int tmp = ary[p];
			ary[p] = ary[q];
			ary[q] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String[] cons = scan.next().split(",");
			int p = Integer.parseInt(cons[0])-1, q = Integer.parseInt(cons[1])-1;
			int tmp = ary[p];
			ary[p] = ary[q];
			ary[q] = tmp;
		} {
			String[] cons = scan.next().split(",");
			int p = Integer.parseInt(cons[0])-1, q = Integer.parseInt(cons[1])-1;
			int tmp = ary[p];
			ary[p] = ary[q];
			ary[q] = tmp;
		} String[] cons = scan.next().split(","); cons scan.next().split(",") scan.next().split scan.next() scan.next scan "," int p = Integer.parseInt(cons[0])-1 p Integer.parseInt(cons[0])-1 Integer.parseInt(cons[0]) Integer.parseInt Integer cons[0] cons 0 1 q = Integer.parseInt(cons[1])-1; q Integer.parseInt(cons[1])-1 Integer.parseInt(cons[1]) Integer.parseInt Integer cons[1] cons 1 1 int tmp = ary[p]; tmp ary[p] ary p ary[p] = ary[q] ary[p] ary p ary[q] ary q ary[q] = tmp ary[q] ary q tmp for (int i = 0; i < w ; i++)
			out.println(ary[i]); int i = 0; int i = 0; i 0 i < w i w i++ i++ i out.println(ary[i]); out.println(ary[i]) out.println out ary[i] ary i out.flush() out.flush out String[] args args static int si() {
		return Integer.parseInt(scan.next());
	} si {
		return Integer.parseInt(scan.next());
	} return Integer.parseInt(scan.next()); Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan public class Main {

	static Scanner scan = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int w = si(), n = si();
		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
			ary[i]=i+1;
		for (int i = 0; i < n; i++) {
			String[] cons = scan.next().split(",");
			int p = Integer.parseInt(cons[0])-1, q = Integer.parseInt(cons[1])-1;
			int tmp = ary[p];
			ary[p] = ary[q];
			ary[q] = tmp;
		}
		for (int i = 0; i < w ; i++)
			out.println(ary[i]);
		out.flush();
	}

	static int si() {
		return Integer.parseInt(scan.next());
	}
} public class Main {

	static Scanner scan = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int w = si(), n = si();
		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
			ary[i]=i+1;
		for (int i = 0; i < n; i++) {
			String[] cons = scan.next().split(",");
			int p = Integer.parseInt(cons[0])-1, q = Integer.parseInt(cons[1])-1;
			int tmp = ary[p];
			ary[p] = ary[q];
			ary[q] = tmp;
		}
		for (int i = 0; i < w ; i++)
			out.println(ary[i]);
		out.flush();
	}

	static int si() {
		return Integer.parseInt(scan.next());
	}
} Main
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int w = si(), n = si();
		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
			ary[i]=i+1;
		for (int i = 0; i < n; i++) {
			String[] cons = scan.next().split(",");
			int p = Integer.parseInt(cons[0])-1, q = Integer.parseInt(cons[1])-1;
			int tmp = ary[p];
			ary[p] = ary[q];
			ary[q] = tmp;
		}
		for (int i = 0; i < w ; i++)
			out.println(ary[i]);
		out.flush();
	}

	static int si() {
		return Integer.parseInt(scan.next());
	}
}