import java.io.*;
import java.util.*;

public class Main {
	
	public static int[] swap (int[] sticks, int s, int g) {
		
		int work = 0;
		
		work = sticks[g];
		sticks[g] = sticks[s];
		sticks[s] = work;
		
		return sticks;
		
	}
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int[] sticks = new int[Integer.parseInt(br.readLine()) + 1];
		int n = Integer.parseInt(br.readLine());
		
		for (int i = 1; i < sticks.length; i++) {
			sticks[i] = i;
		}
		
		for (int i = 0; i < n; i++) {
			
			StringTokenizer st = new StringTokenizer(br.readLine(),",");
			sticks = swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()));
			
		}
		
		for (int s : sticks) {
			if (s == 0) continue;
			System.out.println(s);
		}
		
	}
	
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
	
	public static int[] swap (int[] sticks, int s, int g) {
		
		int work = 0;
		
		work = sticks[g];
		sticks[g] = sticks[s];
		sticks[s] = work;
		
		return sticks;
		
	}
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int[] sticks = new int[Integer.parseInt(br.readLine()) + 1];
		int n = Integer.parseInt(br.readLine());
		
		for (int i = 1; i < sticks.length; i++) {
			sticks[i] = i;
		}
		
		for (int i = 0; i < n; i++) {
			
			StringTokenizer st = new StringTokenizer(br.readLine(),",");
			sticks = swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()));
			
		}
		
		for (int s : sticks) {
			if (s == 0) continue;
			System.out.println(s);
		}
		
	}
	
} Main public static int[] swap (int[] sticks, int s, int g) {
		
		int work = 0;
		
		work = sticks[g];
		sticks[g] = sticks[s];
		sticks[s] = work;
		
		return sticks;
		
	} swap {
		
		int work = 0;
		
		work = sticks[g];
		sticks[g] = sticks[s];
		sticks[s] = work;
		
		return sticks;
		
	} int work = 0; work 0 work = sticks[g] work sticks[g] sticks g sticks[g] = sticks[s] sticks[g] sticks g sticks[s] sticks s sticks[s] = work sticks[s] sticks s work return sticks; sticks int[] sticks sticks int s s int g g public static void main(String[] args) throws IOException {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int[] sticks = new int[Integer.parseInt(br.readLine()) + 1];
		int n = Integer.parseInt(br.readLine());
		
		for (int i = 1; i < sticks.length; i++) {
			sticks[i] = i;
		}
		
		for (int i = 0; i < n; i++) {
			
			StringTokenizer st = new StringTokenizer(br.readLine(),",");
			sticks = swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()));
			
		}
		
		for (int s : sticks) {
			if (s == 0) continue;
			System.out.println(s);
		}
		
	} main {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int[] sticks = new int[Integer.parseInt(br.readLine()) + 1];
		int n = Integer.parseInt(br.readLine());
		
		for (int i = 1; i < sticks.length; i++) {
			sticks[i] = i;
		}
		
		for (int i = 0; i < n; i++) {
			
			StringTokenizer st = new StringTokenizer(br.readLine(),",");
			sticks = swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()));
			
		}
		
		for (int s : sticks) {
			if (s == 0) continue;
			System.out.println(s);
		}
		
	} BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int[] sticks = new int[Integer.parseInt(br.readLine()) + 1]; sticks new int[Integer.parseInt(br.readLine()) + 1] Integer.parseInt(br.readLine()) + 1 Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br 1 int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for (int i = 1; i < sticks.length; i++) {
			sticks[i] = i;
		} int i = 1; int i = 1; i 1 i < sticks.length i sticks.length sticks sticks.length i++ i++ i {
			sticks[i] = i;
		} {
			sticks[i] = i;
		} sticks[i] = i sticks[i] sticks i i for (int i = 0; i < n; i++) {
			
			StringTokenizer st = new StringTokenizer(br.readLine(),",");
			sticks = swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()));
			
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			
			StringTokenizer st = new StringTokenizer(br.readLine(),",");
			sticks = swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()));
			
		} {
			
			StringTokenizer st = new StringTokenizer(br.readLine(),",");
			sticks = swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()));
			
		} StringTokenizer st = new StringTokenizer(br.readLine(),","); st new StringTokenizer(br.readLine(),",") sticks = swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken())) sticks swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken())) swap sticks Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st for (int s : sticks) {
			if (s == 0) continue;
			System.out.println(s);
		} int s sticks {
			if (s == 0) continue;
			System.out.println(s);
		} {
			if (s == 0) continue;
			System.out.println(s);
		} if (s == 0) continue; s == 0 s 0 continue; System.out.println(s) System.out.println System.out System System.out s String[] args args public class Main {
	
	public static int[] swap (int[] sticks, int s, int g) {
		
		int work = 0;
		
		work = sticks[g];
		sticks[g] = sticks[s];
		sticks[s] = work;
		
		return sticks;
		
	}
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int[] sticks = new int[Integer.parseInt(br.readLine()) + 1];
		int n = Integer.parseInt(br.readLine());
		
		for (int i = 1; i < sticks.length; i++) {
			sticks[i] = i;
		}
		
		for (int i = 0; i < n; i++) {
			
			StringTokenizer st = new StringTokenizer(br.readLine(),",");
			sticks = swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()));
			
		}
		
		for (int s : sticks) {
			if (s == 0) continue;
			System.out.println(s);
		}
		
	}
	
} public class Main {
	
	public static int[] swap (int[] sticks, int s, int g) {
		
		int work = 0;
		
		work = sticks[g];
		sticks[g] = sticks[s];
		sticks[s] = work;
		
		return sticks;
		
	}
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int[] sticks = new int[Integer.parseInt(br.readLine()) + 1];
		int n = Integer.parseInt(br.readLine());
		
		for (int i = 1; i < sticks.length; i++) {
			sticks[i] = i;
		}
		
		for (int i = 0; i < n; i++) {
			
			StringTokenizer st = new StringTokenizer(br.readLine(),",");
			sticks = swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()));
			
		}
		
		for (int s : sticks) {
			if (s == 0) continue;
			System.out.println(s);
		}
		
	}
	
} Main
import java.io.*;
import java.util.*;

public class Main {
	
	public static int[] swap (int[] sticks, int s, int g) {
		
		int work = 0;
		
		work = sticks[g];
		sticks[g] = sticks[s];
		sticks[s] = work;
		
		return sticks;
		
	}
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int[] sticks = new int[Integer.parseInt(br.readLine()) + 1];
		int n = Integer.parseInt(br.readLine());
		
		for (int i = 1; i < sticks.length; i++) {
			sticks[i] = i;
		}
		
		for (int i = 0; i < n; i++) {
			
			StringTokenizer st = new StringTokenizer(br.readLine(),",");
			sticks = swap(sticks,Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()));
			
		}
		
		for (int s : sticks) {
			if (s == 0) continue;
			System.out.println(s);
		}
		
	}
	
}