import java.util.Scanner;


public class Main {

	static String swap(String s, int i, int j) {
		StringBuilder sb = new StringBuilder();
		int a, b;
		if (i == j) { return sb.append(s).toString();
		} else if (i < j) { a = i; b = j;
		} else { a = j; b = i; }
		sb.append(s.substring(0, a));
		sb.append(s.charAt(b));
		sb.append(s.substring(a+1, b));
		sb.append(s.charAt(a));
		sb.append(s.substring(b+1));
		return sb.toString();
	}

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

		int W = sc.nextInt(), N = sc.nextInt(); sc.nextLine();
		StringBuilder sb = new StringBuilder();
		for (int i = 0 ; i < W ; i++) sb.append((char) (49+i));
		String str = sb.toString();
		for (int i = 0 ; i < N ; i++) {
			String[] bar = sc.nextLine().split(",");
			str = swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1);
		}
		for (int i = 0 ; i < W ; i++) System.out.println(((int) str.charAt(i))-48);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	static String swap(String s, int i, int j) {
		StringBuilder sb = new StringBuilder();
		int a, b;
		if (i == j) { return sb.append(s).toString();
		} else if (i < j) { a = i; b = j;
		} else { a = j; b = i; }
		sb.append(s.substring(0, a));
		sb.append(s.charAt(b));
		sb.append(s.substring(a+1, b));
		sb.append(s.charAt(a));
		sb.append(s.substring(b+1));
		return sb.toString();
	}

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

		int W = sc.nextInt(), N = sc.nextInt(); sc.nextLine();
		StringBuilder sb = new StringBuilder();
		for (int i = 0 ; i < W ; i++) sb.append((char) (49+i));
		String str = sb.toString();
		for (int i = 0 ; i < N ; i++) {
			String[] bar = sc.nextLine().split(",");
			str = swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1);
		}
		for (int i = 0 ; i < W ; i++) System.out.println(((int) str.charAt(i))-48);
	}
} Main static String swap(String s, int i, int j) {
		StringBuilder sb = new StringBuilder();
		int a, b;
		if (i == j) { return sb.append(s).toString();
		} else if (i < j) { a = i; b = j;
		} else { a = j; b = i; }
		sb.append(s.substring(0, a));
		sb.append(s.charAt(b));
		sb.append(s.substring(a+1, b));
		sb.append(s.charAt(a));
		sb.append(s.substring(b+1));
		return sb.toString();
	} swap {
		StringBuilder sb = new StringBuilder();
		int a, b;
		if (i == j) { return sb.append(s).toString();
		} else if (i < j) { a = i; b = j;
		} else { a = j; b = i; }
		sb.append(s.substring(0, a));
		sb.append(s.charAt(b));
		sb.append(s.substring(a+1, b));
		sb.append(s.charAt(a));
		sb.append(s.substring(b+1));
		return sb.toString();
	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() int a a b; b if (i == j) { return sb.append(s).toString();
		} else if (i < j) { a = i; b = j;
		} else { a = j; b = i; } i == j i j { return sb.append(s).toString();
		} return sb.append(s).toString(); sb.append(s).toString() sb.append(s).toString sb.append(s) sb.append sb s if (i < j) { a = i; b = j;
		} else { a = j; b = i; } i < j i j { a = i; b = j;
		} a = i a i b = j b j { a = j; b = i; } a = j a j b = i b i sb.append(s.substring(0, a)) sb.append sb s.substring(0, a) s.substring s 0 a sb.append(s.charAt(b)) sb.append sb s.charAt(b) s.charAt s b sb.append(s.substring(a+1, b)) sb.append sb s.substring(a+1, b) s.substring s a+1 a 1 b sb.append(s.charAt(a)) sb.append sb s.charAt(a) s.charAt s a sb.append(s.substring(b+1)) sb.append sb s.substring(b+1) s.substring s b+1 b 1 return sb.toString(); sb.toString() sb.toString sb String s s int i i int j j public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int W = sc.nextInt(), N = sc.nextInt(); sc.nextLine();
		StringBuilder sb = new StringBuilder();
		for (int i = 0 ; i < W ; i++) sb.append((char) (49+i));
		String str = sb.toString();
		for (int i = 0 ; i < N ; i++) {
			String[] bar = sc.nextLine().split(",");
			str = swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1);
		}
		for (int i = 0 ; i < W ; i++) System.out.println(((int) str.charAt(i))-48);
	} main {
		Scanner sc = new Scanner(System.in);

		int W = sc.nextInt(), N = sc.nextInt(); sc.nextLine();
		StringBuilder sb = new StringBuilder();
		for (int i = 0 ; i < W ; i++) sb.append((char) (49+i));
		String str = sb.toString();
		for (int i = 0 ; i < N ; i++) {
			String[] bar = sc.nextLine().split(",");
			str = swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1);
		}
		for (int i = 0 ; i < W ; i++) System.out.println(((int) str.charAt(i))-48);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int W = sc.nextInt() W sc.nextInt() sc.nextInt sc N = sc.nextInt(); N sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0 ; i < W ; i++) sb.append((char) (49+i)); int i = 0 ; int i = 0 ; i 0 i < W i W i++ i++ i sb.append((char) (49+i)); sb.append((char) (49+i)) sb.append sb (char) (49+i) 49 i String str = sb.toString(); str sb.toString() sb.toString sb for (int i = 0 ; i < N ; i++) {
			String[] bar = sc.nextLine().split(",");
			str = swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1);
		} int i = 0 ; int i = 0 ; i 0 i < N i N i++ i++ i {
			String[] bar = sc.nextLine().split(",");
			str = swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1);
		} {
			String[] bar = sc.nextLine().split(",");
			str = swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1);
		} String[] bar = sc.nextLine().split(","); bar sc.nextLine().split(",") sc.nextLine().split sc.nextLine() sc.nextLine sc "," str = swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1) str swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1) swap str Integer.parseInt(bar[0])-1 Integer.parseInt(bar[0]) Integer.parseInt Integer bar[0] bar 0 1 Integer.parseInt(bar[1])-1 Integer.parseInt(bar[1]) Integer.parseInt Integer bar[1] bar 1 1 for (int i = 0 ; i < W ; i++) System.out.println(((int) str.charAt(i))-48); int i = 0 ; int i = 0 ; i 0 i < W i W i++ i++ i System.out.println(((int) str.charAt(i))-48); System.out.println(((int) str.charAt(i))-48) System.out.println System.out System System.out ((int) str.charAt(i))-48 ((int) str.charAt(i)) str.charAt str i 48 String[] args args public class Main {

	static String swap(String s, int i, int j) {
		StringBuilder sb = new StringBuilder();
		int a, b;
		if (i == j) { return sb.append(s).toString();
		} else if (i < j) { a = i; b = j;
		} else { a = j; b = i; }
		sb.append(s.substring(0, a));
		sb.append(s.charAt(b));
		sb.append(s.substring(a+1, b));
		sb.append(s.charAt(a));
		sb.append(s.substring(b+1));
		return sb.toString();
	}

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

		int W = sc.nextInt(), N = sc.nextInt(); sc.nextLine();
		StringBuilder sb = new StringBuilder();
		for (int i = 0 ; i < W ; i++) sb.append((char) (49+i));
		String str = sb.toString();
		for (int i = 0 ; i < N ; i++) {
			String[] bar = sc.nextLine().split(",");
			str = swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1);
		}
		for (int i = 0 ; i < W ; i++) System.out.println(((int) str.charAt(i))-48);
	}
} public class Main {

	static String swap(String s, int i, int j) {
		StringBuilder sb = new StringBuilder();
		int a, b;
		if (i == j) { return sb.append(s).toString();
		} else if (i < j) { a = i; b = j;
		} else { a = j; b = i; }
		sb.append(s.substring(0, a));
		sb.append(s.charAt(b));
		sb.append(s.substring(a+1, b));
		sb.append(s.charAt(a));
		sb.append(s.substring(b+1));
		return sb.toString();
	}

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

		int W = sc.nextInt(), N = sc.nextInt(); sc.nextLine();
		StringBuilder sb = new StringBuilder();
		for (int i = 0 ; i < W ; i++) sb.append((char) (49+i));
		String str = sb.toString();
		for (int i = 0 ; i < N ; i++) {
			String[] bar = sc.nextLine().split(",");
			str = swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1);
		}
		for (int i = 0 ; i < W ; i++) System.out.println(((int) str.charAt(i))-48);
	}
} Main
import java.util.Scanner;


public class Main {

	static String swap(String s, int i, int j) {
		StringBuilder sb = new StringBuilder();
		int a, b;
		if (i == j) { return sb.append(s).toString();
		} else if (i < j) { a = i; b = j;
		} else { a = j; b = i; }
		sb.append(s.substring(0, a));
		sb.append(s.charAt(b));
		sb.append(s.substring(a+1, b));
		sb.append(s.charAt(a));
		sb.append(s.substring(b+1));
		return sb.toString();
	}

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

		int W = sc.nextInt(), N = sc.nextInt(); sc.nextLine();
		StringBuilder sb = new StringBuilder();
		for (int i = 0 ; i < W ; i++) sb.append((char) (49+i));
		String str = sb.toString();
		for (int i = 0 ; i < N ; i++) {
			String[] bar = sc.nextLine().split(",");
			str = swap(str, Integer.parseInt(bar[0])-1, Integer.parseInt(bar[1])-1);
		}
		for (int i = 0 ; i < W ; i++) System.out.println(((int) str.charAt(i))-48);
	}
}