import java.util.ArrayList;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		ArrayList<Integer> w_list = new ArrayList<Integer>();
		
		int w = sc.nextInt();
		int n = sc.nextInt();
		
		for(int i = 0; i < w; i++){
			w_list.add(i + 1);
		}
		
		for(int i = 0; i < n; i++){
			String[] str = sc.next().split(",");
			
			int a = Integer.parseInt(str[0]);
			int b = Integer.parseInt(str[1]);
			
			int tmp_a = w_list.get(a - 1);
			int tmp_b = w_list.get(b - 1);
			
			w_list.set(a - 1, tmp_b);
			w_list.set(b - 1, tmp_a);
		}
		
		print(w_list);
	}
	
	public static void print(ArrayList<Integer> a) {
		for(int i = 0; i < a.size(); i++)
			System.out.println(a.get(i));
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		ArrayList<Integer> w_list = new ArrayList<Integer>();
		
		int w = sc.nextInt();
		int n = sc.nextInt();
		
		for(int i = 0; i < w; i++){
			w_list.add(i + 1);
		}
		
		for(int i = 0; i < n; i++){
			String[] str = sc.next().split(",");
			
			int a = Integer.parseInt(str[0]);
			int b = Integer.parseInt(str[1]);
			
			int tmp_a = w_list.get(a - 1);
			int tmp_b = w_list.get(b - 1);
			
			w_list.set(a - 1, tmp_b);
			w_list.set(b - 1, tmp_a);
		}
		
		print(w_list);
	}
	
	public static void print(ArrayList<Integer> a) {
		for(int i = 0; i < a.size(); i++)
			System.out.println(a.get(i));
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		ArrayList<Integer> w_list = new ArrayList<Integer>();
		
		int w = sc.nextInt();
		int n = sc.nextInt();
		
		for(int i = 0; i < w; i++){
			w_list.add(i + 1);
		}
		
		for(int i = 0; i < n; i++){
			String[] str = sc.next().split(",");
			
			int a = Integer.parseInt(str[0]);
			int b = Integer.parseInt(str[1]);
			
			int tmp_a = w_list.get(a - 1);
			int tmp_b = w_list.get(b - 1);
			
			w_list.set(a - 1, tmp_b);
			w_list.set(b - 1, tmp_a);
		}
		
		print(w_list);
	} main {
		Scanner sc = new Scanner(System.in);
		
		ArrayList<Integer> w_list = new ArrayList<Integer>();
		
		int w = sc.nextInt();
		int n = sc.nextInt();
		
		for(int i = 0; i < w; i++){
			w_list.add(i + 1);
		}
		
		for(int i = 0; i < n; i++){
			String[] str = sc.next().split(",");
			
			int a = Integer.parseInt(str[0]);
			int b = Integer.parseInt(str[1]);
			
			int tmp_a = w_list.get(a - 1);
			int tmp_b = w_list.get(b - 1);
			
			w_list.set(a - 1, tmp_b);
			w_list.set(b - 1, tmp_a);
		}
		
		print(w_list);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> w_list = new ArrayList<Integer>(); w_list new ArrayList<Integer>() int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i = 0; i < w; i++){
			w_list.add(i + 1);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			w_list.add(i + 1);
		} {
			w_list.add(i + 1);
		} w_list.add(i + 1) w_list.add w_list i + 1 i 1 for(int i = 0; i < n; i++){
			String[] str = sc.next().split(",");
			
			int a = Integer.parseInt(str[0]);
			int b = Integer.parseInt(str[1]);
			
			int tmp_a = w_list.get(a - 1);
			int tmp_b = w_list.get(b - 1);
			
			w_list.set(a - 1, tmp_b);
			w_list.set(b - 1, tmp_a);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String[] str = sc.next().split(",");
			
			int a = Integer.parseInt(str[0]);
			int b = Integer.parseInt(str[1]);
			
			int tmp_a = w_list.get(a - 1);
			int tmp_b = w_list.get(b - 1);
			
			w_list.set(a - 1, tmp_b);
			w_list.set(b - 1, tmp_a);
		} {
			String[] str = sc.next().split(",");
			
			int a = Integer.parseInt(str[0]);
			int b = Integer.parseInt(str[1]);
			
			int tmp_a = w_list.get(a - 1);
			int tmp_b = w_list.get(b - 1);
			
			w_list.set(a - 1, tmp_b);
			w_list.set(b - 1, tmp_a);
		} String[] str = sc.next().split(","); str sc.next().split(",") sc.next().split sc.next() sc.next sc "," int a = Integer.parseInt(str[0]); a Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int b = Integer.parseInt(str[1]); b Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 int tmp_a = w_list.get(a - 1); tmp_a w_list.get(a - 1) w_list.get w_list a - 1 a 1 int tmp_b = w_list.get(b - 1); tmp_b w_list.get(b - 1) w_list.get w_list b - 1 b 1 w_list.set(a - 1, tmp_b) w_list.set w_list a - 1 a 1 tmp_b w_list.set(b - 1, tmp_a) w_list.set w_list b - 1 b 1 tmp_a print(w_list) print w_list String[] args args public static void print(ArrayList<Integer> a) {
		for(int i = 0; i < a.size(); i++)
			System.out.println(a.get(i));
	} print {
		for(int i = 0; i < a.size(); i++)
			System.out.println(a.get(i));
	} for(int i = 0; i < a.size(); i++)
			System.out.println(a.get(i)); int i = 0; int i = 0; i 0 i < a.size() i a.size() a.size a i++ i++ i System.out.println(a.get(i)); System.out.println(a.get(i)) System.out.println System.out System System.out a.get(i) a.get a i ArrayList<Integer> a a public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		ArrayList<Integer> w_list = new ArrayList<Integer>();
		
		int w = sc.nextInt();
		int n = sc.nextInt();
		
		for(int i = 0; i < w; i++){
			w_list.add(i + 1);
		}
		
		for(int i = 0; i < n; i++){
			String[] str = sc.next().split(",");
			
			int a = Integer.parseInt(str[0]);
			int b = Integer.parseInt(str[1]);
			
			int tmp_a = w_list.get(a - 1);
			int tmp_b = w_list.get(b - 1);
			
			w_list.set(a - 1, tmp_b);
			w_list.set(b - 1, tmp_a);
		}
		
		print(w_list);
	}
	
	public static void print(ArrayList<Integer> a) {
		for(int i = 0; i < a.size(); i++)
			System.out.println(a.get(i));
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		ArrayList<Integer> w_list = new ArrayList<Integer>();
		
		int w = sc.nextInt();
		int n = sc.nextInt();
		
		for(int i = 0; i < w; i++){
			w_list.add(i + 1);
		}
		
		for(int i = 0; i < n; i++){
			String[] str = sc.next().split(",");
			
			int a = Integer.parseInt(str[0]);
			int b = Integer.parseInt(str[1]);
			
			int tmp_a = w_list.get(a - 1);
			int tmp_b = w_list.get(b - 1);
			
			w_list.set(a - 1, tmp_b);
			w_list.set(b - 1, tmp_a);
		}
		
		print(w_list);
	}
	
	public static void print(ArrayList<Integer> a) {
		for(int i = 0; i < a.size(); i++)
			System.out.println(a.get(i));
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		ArrayList<Integer> w_list = new ArrayList<Integer>();
		
		int w = sc.nextInt();
		int n = sc.nextInt();
		
		for(int i = 0; i < w; i++){
			w_list.add(i + 1);
		}
		
		for(int i = 0; i < n; i++){
			String[] str = sc.next().split(",");
			
			int a = Integer.parseInt(str[0]);
			int b = Integer.parseInt(str[1]);
			
			int tmp_a = w_list.get(a - 1);
			int tmp_b = w_list.get(b - 1);
			
			w_list.set(a - 1, tmp_b);
			w_list.set(b - 1, tmp_a);
		}
		
		print(w_list);
	}
	
	public static void print(ArrayList<Integer> a) {
		for(int i = 0; i < a.size(); i++)
			System.out.println(a.get(i));
	}
}