import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lot = new int[w];
		sc.nextLine();
		for(int i = 0 ; i < w ; i++){
			lot[i] = i+1;
		}
		for(int i = 0; i < n; i++){
			swap(lot, sc.nextLine().split(","));
		}
		sc.close();
		for(int i = 0; i < w; i++){
			System.out.println(lot[i]);
		}
	}
	static void swap(int[] source, String[] s){
		int a = Integer.parseInt(s[0])-1;
		int b = Integer.parseInt(s[1])-1;
		int tmp = source[a];
		source[a] = source[b];
		source[b] = tmp;
	}
} import java.util.*; util.* java class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lot = new int[w];
		sc.nextLine();
		for(int i = 0 ; i < w ; i++){
			lot[i] = i+1;
		}
		for(int i = 0; i < n; i++){
			swap(lot, sc.nextLine().split(","));
		}
		sc.close();
		for(int i = 0; i < w; i++){
			System.out.println(lot[i]);
		}
	}
	static void swap(int[] source, String[] s){
		int a = Integer.parseInt(s[0])-1;
		int b = Integer.parseInt(s[1])-1;
		int tmp = source[a];
		source[a] = source[b];
		source[b] = tmp;
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lot = new int[w];
		sc.nextLine();
		for(int i = 0 ; i < w ; i++){
			lot[i] = i+1;
		}
		for(int i = 0; i < n; i++){
			swap(lot, sc.nextLine().split(","));
		}
		sc.close();
		for(int i = 0; i < w; i++){
			System.out.println(lot[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lot = new int[w];
		sc.nextLine();
		for(int i = 0 ; i < w ; i++){
			lot[i] = i+1;
		}
		for(int i = 0; i < n; i++){
			swap(lot, sc.nextLine().split(","));
		}
		sc.close();
		for(int i = 0; i < w; i++){
			System.out.println(lot[i]);
		}
	} 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[] lot = new int[w]; lot new int[w] w sc.nextLine() sc.nextLine sc for(int i = 0 ; i < w ; i++){
			lot[i] = i+1;
		} int i = 0 ; int i = 0 ; i 0 i < w i w i++ i++ i {
			lot[i] = i+1;
		} {
			lot[i] = i+1;
		} lot[i] = i+1 lot[i] lot i i+1 i 1 for(int i = 0; i < n; i++){
			swap(lot, sc.nextLine().split(","));
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			swap(lot, sc.nextLine().split(","));
		} {
			swap(lot, sc.nextLine().split(","));
		} swap(lot, sc.nextLine().split(",")) swap lot sc.nextLine().split(",") sc.nextLine().split sc.nextLine() sc.nextLine sc "," sc.close() sc.close sc for(int i = 0; i < w; i++){
			System.out.println(lot[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(lot[i]);
		} {
			System.out.println(lot[i]);
		} System.out.println(lot[i]) System.out.println System.out System System.out lot[i] lot i String[] args args static void swap(int[] source, String[] s){
		int a = Integer.parseInt(s[0])-1;
		int b = Integer.parseInt(s[1])-1;
		int tmp = source[a];
		source[a] = source[b];
		source[b] = tmp;
	} swap {
		int a = Integer.parseInt(s[0])-1;
		int b = Integer.parseInt(s[1])-1;
		int tmp = source[a];
		source[a] = source[b];
		source[b] = tmp;
	} int a = Integer.parseInt(s[0])-1; a Integer.parseInt(s[0])-1 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 1 int b = Integer.parseInt(s[1])-1; b Integer.parseInt(s[1])-1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 1 int tmp = source[a]; tmp source[a] source a source[a] = source[b] source[a] source a source[b] source b source[b] = tmp source[b] source b tmp int[] source source String[] s s
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] lot = new int[w];
		sc.nextLine();
		for(int i = 0 ; i < w ; i++){
			lot[i] = i+1;
		}
		for(int i = 0; i < n; i++){
			swap(lot, sc.nextLine().split(","));
		}
		sc.close();
		for(int i = 0; i < w; i++){
			System.out.println(lot[i]);
		}
	}
	static void swap(int[] source, String[] s){
		int a = Integer.parseInt(s[0])-1;
		int b = Integer.parseInt(s[1])-1;
		int tmp = source[a];
		source[a] = source[b];
		source[b] = tmp;
	}
}