import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] horizontalLine = new int[n][2];
		String[] input = null;
		for(int i = 0; i < n; i++){
			input = sc.next().split(",");
			horizontalLine[i][0] = Integer.parseInt(input[0]);
			horizontalLine[i][1] = Integer.parseInt(input[1]);
		}
		int[] result = solve(w, horizontalLine);
		for(int i : result){
			System.out.println(i);
		}
		sc.close();
	}

	public static int[] solve(int numVerticalLines, int[][] horizontalLine){
		//initialize
		int[] n = new int[numVerticalLines];
		for(int i = 0; i < numVerticalLines; i++){
			n[i] = i + 1;
		}
		
		//solve
		for(int i = 0; i < horizontalLine.length; i++){
			int source = horizontalLine[i][0] - 1;
			int target = horizontalLine[i][1] - 1;
			int tmp = n[source];
			n[source] = n[target];
			n[target] = tmp;
		}
		return n;
	}
} import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] horizontalLine = new int[n][2];
		String[] input = null;
		for(int i = 0; i < n; i++){
			input = sc.next().split(",");
			horizontalLine[i][0] = Integer.parseInt(input[0]);
			horizontalLine[i][1] = Integer.parseInt(input[1]);
		}
		int[] result = solve(w, horizontalLine);
		for(int i : result){
			System.out.println(i);
		}
		sc.close();
	}

	public static int[] solve(int numVerticalLines, int[][] horizontalLine){
		//initialize
		int[] n = new int[numVerticalLines];
		for(int i = 0; i < numVerticalLines; i++){
			n[i] = i + 1;
		}
		
		//solve
		for(int i = 0; i < horizontalLine.length; i++){
			int source = horizontalLine[i][0] - 1;
			int target = horizontalLine[i][1] - 1;
			int tmp = n[source];
			n[source] = n[target];
			n[target] = tmp;
		}
		return n;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] horizontalLine = new int[n][2];
		String[] input = null;
		for(int i = 0; i < n; i++){
			input = sc.next().split(",");
			horizontalLine[i][0] = Integer.parseInt(input[0]);
			horizontalLine[i][1] = Integer.parseInt(input[1]);
		}
		int[] result = solve(w, horizontalLine);
		for(int i : result){
			System.out.println(i);
		}
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] horizontalLine = new int[n][2];
		String[] input = null;
		for(int i = 0; i < n; i++){
			input = sc.next().split(",");
			horizontalLine[i][0] = Integer.parseInt(input[0]);
			horizontalLine[i][1] = Integer.parseInt(input[1]);
		}
		int[] result = solve(w, horizontalLine);
		for(int i : result){
			System.out.println(i);
		}
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[][] horizontalLine = new int[n][2]; horizontalLine new int[n][2] n 2 String[] input = null; input null for(int i = 0; i < n; i++){
			input = sc.next().split(",");
			horizontalLine[i][0] = Integer.parseInt(input[0]);
			horizontalLine[i][1] = Integer.parseInt(input[1]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			input = sc.next().split(",");
			horizontalLine[i][0] = Integer.parseInt(input[0]);
			horizontalLine[i][1] = Integer.parseInt(input[1]);
		} {
			input = sc.next().split(",");
			horizontalLine[i][0] = Integer.parseInt(input[0]);
			horizontalLine[i][1] = Integer.parseInt(input[1]);
		} input = sc.next().split(",") input sc.next().split(",") sc.next().split sc.next() sc.next sc "," horizontalLine[i][0] = Integer.parseInt(input[0]) horizontalLine[i][0] horizontalLine[i] horizontalLine i 0 Integer.parseInt(input[0]) Integer.parseInt Integer input[0] input 0 horizontalLine[i][1] = Integer.parseInt(input[1]) horizontalLine[i][1] horizontalLine[i] horizontalLine i 1 Integer.parseInt(input[1]) Integer.parseInt Integer input[1] input 1 int[] result = solve(w, horizontalLine); result solve(w, horizontalLine) solve w horizontalLine for(int i : result){
			System.out.println(i);
		} int i result {
			System.out.println(i);
		} {
			System.out.println(i);
		} System.out.println(i) System.out.println System.out System System.out i sc.close() sc.close sc String[] args args public static int[] solve(int numVerticalLines, int[][] horizontalLine){
		//initialize
		int[] n = new int[numVerticalLines];
		for(int i = 0; i < numVerticalLines; i++){
			n[i] = i + 1;
		}
		
		//solve
		for(int i = 0; i < horizontalLine.length; i++){
			int source = horizontalLine[i][0] - 1;
			int target = horizontalLine[i][1] - 1;
			int tmp = n[source];
			n[source] = n[target];
			n[target] = tmp;
		}
		return n;
	} solve {
		//initialize
		int[] n = new int[numVerticalLines];
		for(int i = 0; i < numVerticalLines; i++){
			n[i] = i + 1;
		}
		
		//solve
		for(int i = 0; i < horizontalLine.length; i++){
			int source = horizontalLine[i][0] - 1;
			int target = horizontalLine[i][1] - 1;
			int tmp = n[source];
			n[source] = n[target];
			n[target] = tmp;
		}
		return n;
	} int[] n = new int[numVerticalLines]; n new int[numVerticalLines] numVerticalLines for(int i = 0; i < numVerticalLines; i++){
			n[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < numVerticalLines i numVerticalLines i++ i++ i {
			n[i] = i + 1;
		} {
			n[i] = i + 1;
		} n[i] = i + 1 n[i] n i i + 1 i 1 for(int i = 0; i < horizontalLine.length; i++){
			int source = horizontalLine[i][0] - 1;
			int target = horizontalLine[i][1] - 1;
			int tmp = n[source];
			n[source] = n[target];
			n[target] = tmp;
		} int i = 0; int i = 0; i 0 i < horizontalLine.length i horizontalLine.length horizontalLine horizontalLine.length i++ i++ i {
			int source = horizontalLine[i][0] - 1;
			int target = horizontalLine[i][1] - 1;
			int tmp = n[source];
			n[source] = n[target];
			n[target] = tmp;
		} {
			int source = horizontalLine[i][0] - 1;
			int target = horizontalLine[i][1] - 1;
			int tmp = n[source];
			n[source] = n[target];
			n[target] = tmp;
		} int source = horizontalLine[i][0] - 1; source horizontalLine[i][0] - 1 horizontalLine[i][0] horizontalLine[i] horizontalLine i 0 1 int target = horizontalLine[i][1] - 1; target horizontalLine[i][1] - 1 horizontalLine[i][1] horizontalLine[i] horizontalLine i 1 1 int tmp = n[source]; tmp n[source] n source n[source] = n[target] n[source] n source n[target] n target n[target] = tmp n[target] n target tmp return n; n int numVerticalLines numVerticalLines int[][] horizontalLine horizontalLine public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] horizontalLine = new int[n][2];
		String[] input = null;
		for(int i = 0; i < n; i++){
			input = sc.next().split(",");
			horizontalLine[i][0] = Integer.parseInt(input[0]);
			horizontalLine[i][1] = Integer.parseInt(input[1]);
		}
		int[] result = solve(w, horizontalLine);
		for(int i : result){
			System.out.println(i);
		}
		sc.close();
	}

	public static int[] solve(int numVerticalLines, int[][] horizontalLine){
		//initialize
		int[] n = new int[numVerticalLines];
		for(int i = 0; i < numVerticalLines; i++){
			n[i] = i + 1;
		}
		
		//solve
		for(int i = 0; i < horizontalLine.length; i++){
			int source = horizontalLine[i][0] - 1;
			int target = horizontalLine[i][1] - 1;
			int tmp = n[source];
			n[source] = n[target];
			n[target] = tmp;
		}
		return n;
	}
} public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] horizontalLine = new int[n][2];
		String[] input = null;
		for(int i = 0; i < n; i++){
			input = sc.next().split(",");
			horizontalLine[i][0] = Integer.parseInt(input[0]);
			horizontalLine[i][1] = Integer.parseInt(input[1]);
		}
		int[] result = solve(w, horizontalLine);
		for(int i : result){
			System.out.println(i);
		}
		sc.close();
	}

	public static int[] solve(int numVerticalLines, int[][] horizontalLine){
		//initialize
		int[] n = new int[numVerticalLines];
		for(int i = 0; i < numVerticalLines; i++){
			n[i] = i + 1;
		}
		
		//solve
		for(int i = 0; i < horizontalLine.length; i++){
			int source = horizontalLine[i][0] - 1;
			int target = horizontalLine[i][1] - 1;
			int tmp = n[source];
			n[source] = n[target];
			n[target] = tmp;
		}
		return n;
	}
} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] horizontalLine = new int[n][2];
		String[] input = null;
		for(int i = 0; i < n; i++){
			input = sc.next().split(",");
			horizontalLine[i][0] = Integer.parseInt(input[0]);
			horizontalLine[i][1] = Integer.parseInt(input[1]);
		}
		int[] result = solve(w, horizontalLine);
		for(int i : result){
			System.out.println(i);
		}
		sc.close();
	}

	public static int[] solve(int numVerticalLines, int[][] horizontalLine){
		//initialize
		int[] n = new int[numVerticalLines];
		for(int i = 0; i < numVerticalLines; i++){
			n[i] = i + 1;
		}
		
		//solve
		for(int i = 0; i < horizontalLine.length; i++){
			int source = horizontalLine[i][0] - 1;
			int target = horizontalLine[i][1] - 1;
			int tmp = n[source];
			n[source] = n[target];
			n[target] = tmp;
		}
		return n;
	}
}