import java.util.*;
import java.text.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<Integer>();
		int w = in.nextInt();
		for(int i=0; i<w; i++){
			list.add(i+1);
		}
		
		int n = in.nextInt();
		for(int i=0; i<n; i++){
			String tmp = in.next();
			StringTokenizer str = new StringTokenizer(tmp, ",");
			int a = Integer.parseInt(str.nextToken());
			int b = Integer.parseInt(str.nextToken());
			int x = list.get(a-1);
			list.set(a-1, list.get(b-1));
			list.set(b-1, x);
		}
		
		for(int i=0; i<list.size(); i++){
			System.out.println(list.get(i));
		}
	}
} import java.util.*; util.* java import java.text.*; text.* java public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<Integer>();
		int w = in.nextInt();
		for(int i=0; i<w; i++){
			list.add(i+1);
		}
		
		int n = in.nextInt();
		for(int i=0; i<n; i++){
			String tmp = in.next();
			StringTokenizer str = new StringTokenizer(tmp, ",");
			int a = Integer.parseInt(str.nextToken());
			int b = Integer.parseInt(str.nextToken());
			int x = list.get(a-1);
			list.set(a-1, list.get(b-1));
			list.set(b-1, x);
		}
		
		for(int i=0; i<list.size(); i++){
			System.out.println(list.get(i));
		}
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<Integer>();
		int w = in.nextInt();
		for(int i=0; i<w; i++){
			list.add(i+1);
		}
		
		int n = in.nextInt();
		for(int i=0; i<n; i++){
			String tmp = in.next();
			StringTokenizer str = new StringTokenizer(tmp, ",");
			int a = Integer.parseInt(str.nextToken());
			int b = Integer.parseInt(str.nextToken());
			int x = list.get(a-1);
			list.set(a-1, list.get(b-1));
			list.set(b-1, x);
		}
		
		for(int i=0; i<list.size(); i++){
			System.out.println(list.get(i));
		}
	} main {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<Integer>();
		int w = in.nextInt();
		for(int i=0; i<w; i++){
			list.add(i+1);
		}
		
		int n = in.nextInt();
		for(int i=0; i<n; i++){
			String tmp = in.next();
			StringTokenizer str = new StringTokenizer(tmp, ",");
			int a = Integer.parseInt(str.nextToken());
			int b = Integer.parseInt(str.nextToken());
			int x = list.get(a-1);
			list.set(a-1, list.get(b-1));
			list.set(b-1, x);
		}
		
		for(int i=0; i<list.size(); i++){
			System.out.println(list.get(i));
		}
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() int w = in.nextInt(); w in.nextInt() in.nextInt in for(int i=0; i<w; i++){
			list.add(i+1);
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			list.add(i+1);
		} {
			list.add(i+1);
		} list.add(i+1) list.add list i+1 i 1 int n = in.nextInt(); n in.nextInt() in.nextInt in for(int i=0; i<n; i++){
			String tmp = in.next();
			StringTokenizer str = new StringTokenizer(tmp, ",");
			int a = Integer.parseInt(str.nextToken());
			int b = Integer.parseInt(str.nextToken());
			int x = list.get(a-1);
			list.set(a-1, list.get(b-1));
			list.set(b-1, x);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String tmp = in.next();
			StringTokenizer str = new StringTokenizer(tmp, ",");
			int a = Integer.parseInt(str.nextToken());
			int b = Integer.parseInt(str.nextToken());
			int x = list.get(a-1);
			list.set(a-1, list.get(b-1));
			list.set(b-1, x);
		} {
			String tmp = in.next();
			StringTokenizer str = new StringTokenizer(tmp, ",");
			int a = Integer.parseInt(str.nextToken());
			int b = Integer.parseInt(str.nextToken());
			int x = list.get(a-1);
			list.set(a-1, list.get(b-1));
			list.set(b-1, x);
		} String tmp = in.next(); tmp in.next() in.next in StringTokenizer str = new StringTokenizer(tmp, ","); str new StringTokenizer(tmp, ",") int a = Integer.parseInt(str.nextToken()); a Integer.parseInt(str.nextToken()) Integer.parseInt Integer str.nextToken() str.nextToken str int b = Integer.parseInt(str.nextToken()); b Integer.parseInt(str.nextToken()) Integer.parseInt Integer str.nextToken() str.nextToken str int x = list.get(a-1); x list.get(a-1) list.get list a-1 a 1 list.set(a-1, list.get(b-1)) list.set list a-1 a 1 list.get(b-1) list.get list b-1 b 1 list.set(b-1, x) list.set list b-1 b 1 x for(int i=0; i<list.size(); i++){
			System.out.println(list.get(i));
		} int i=0; int i=0; i 0 i<list.size() i list.size() list.size list i++ i++ i {
			System.out.println(list.get(i));
		} {
			System.out.println(list.get(i));
		} System.out.println(list.get(i)) System.out.println System.out System System.out list.get(i) list.get list i String[] args args public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<Integer>();
		int w = in.nextInt();
		for(int i=0; i<w; i++){
			list.add(i+1);
		}
		
		int n = in.nextInt();
		for(int i=0; i<n; i++){
			String tmp = in.next();
			StringTokenizer str = new StringTokenizer(tmp, ",");
			int a = Integer.parseInt(str.nextToken());
			int b = Integer.parseInt(str.nextToken());
			int x = list.get(a-1);
			list.set(a-1, list.get(b-1));
			list.set(b-1, x);
		}
		
		for(int i=0; i<list.size(); i++){
			System.out.println(list.get(i));
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<Integer>();
		int w = in.nextInt();
		for(int i=0; i<w; i++){
			list.add(i+1);
		}
		
		int n = in.nextInt();
		for(int i=0; i<n; i++){
			String tmp = in.next();
			StringTokenizer str = new StringTokenizer(tmp, ",");
			int a = Integer.parseInt(str.nextToken());
			int b = Integer.parseInt(str.nextToken());
			int x = list.get(a-1);
			list.set(a-1, list.get(b-1));
			list.set(b-1, x);
		}
		
		for(int i=0; i<list.size(); i++){
			System.out.println(list.get(i));
		}
	}
} Main
import java.util.*;
import java.text.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<Integer>();
		int w = in.nextInt();
		for(int i=0; i<w; i++){
			list.add(i+1);
		}
		
		int n = in.nextInt();
		for(int i=0; i<n; i++){
			String tmp = in.next();
			StringTokenizer str = new StringTokenizer(tmp, ",");
			int a = Integer.parseInt(str.nextToken());
			int b = Integer.parseInt(str.nextToken());
			int x = list.get(a-1);
			list.set(a-1, list.get(b-1));
			list.set(b-1, x);
		}
		
		for(int i=0; i<list.size(); i++){
			System.out.println(list.get(i));
		}
	}
}