import java.util.Scanner;
public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int T[] = new int[w];
		for(int i=0;i<w;i++){
				T[i]=i+1;
				//System.out.println(T[i]);
			}
		int n = sc.nextInt();
			for(int i = 0;i<n;i++ ){
				int temp = 0;
				String A = sc.next();
				String[] fruit = A.split(",");
				int a = Integer.parseInt(fruit[0]);
				int b = Integer.parseInt(fruit[1]);
				temp = T[a-1];
				T[a-1]=T[b-1];
				T[b-1]=temp;
				
			}
			for(int i = 0;i<w;i++){
				System.out.println(T[i]);
			}
	}
} 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 T[] = new int[w];
		for(int i=0;i<w;i++){
				T[i]=i+1;
				//System.out.println(T[i]);
			}
		int n = sc.nextInt();
			for(int i = 0;i<n;i++ ){
				int temp = 0;
				String A = sc.next();
				String[] fruit = A.split(",");
				int a = Integer.parseInt(fruit[0]);
				int b = Integer.parseInt(fruit[1]);
				temp = T[a-1];
				T[a-1]=T[b-1];
				T[b-1]=temp;
				
			}
			for(int i = 0;i<w;i++){
				System.out.println(T[i]);
			}
	}
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int T[] = new int[w];
		for(int i=0;i<w;i++){
				T[i]=i+1;
				//System.out.println(T[i]);
			}
		int n = sc.nextInt();
			for(int i = 0;i<n;i++ ){
				int temp = 0;
				String A = sc.next();
				String[] fruit = A.split(",");
				int a = Integer.parseInt(fruit[0]);
				int b = Integer.parseInt(fruit[1]);
				temp = T[a-1];
				T[a-1]=T[b-1];
				T[b-1]=temp;
				
			}
			for(int i = 0;i<w;i++){
				System.out.println(T[i]);
			}
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int T[] = new int[w];
		for(int i=0;i<w;i++){
				T[i]=i+1;
				//System.out.println(T[i]);
			}
		int n = sc.nextInt();
			for(int i = 0;i<n;i++ ){
				int temp = 0;
				String A = sc.next();
				String[] fruit = A.split(",");
				int a = Integer.parseInt(fruit[0]);
				int b = Integer.parseInt(fruit[1]);
				temp = T[a-1];
				T[a-1]=T[b-1];
				T[b-1]=temp;
				
			}
			for(int i = 0;i<w;i++){
				System.out.println(T[i]);
			}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int T[] = new int[w]; T new int[w] w for(int i=0;i<w;i++){
				T[i]=i+1;
				//System.out.println(T[i]);
			} int i=0; int i=0; i 0 i<w i w i++ i++ i {
				T[i]=i+1;
				//System.out.println(T[i]);
			} {
				T[i]=i+1;
				//System.out.println(T[i]);
			} T[i]=i+1 T[i] T i i+1 i 1 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i = 0;i<n;i++ ){
				int temp = 0;
				String A = sc.next();
				String[] fruit = A.split(",");
				int a = Integer.parseInt(fruit[0]);
				int b = Integer.parseInt(fruit[1]);
				temp = T[a-1];
				T[a-1]=T[b-1];
				T[b-1]=temp;
				
			} int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
				int temp = 0;
				String A = sc.next();
				String[] fruit = A.split(",");
				int a = Integer.parseInt(fruit[0]);
				int b = Integer.parseInt(fruit[1]);
				temp = T[a-1];
				T[a-1]=T[b-1];
				T[b-1]=temp;
				
			} {
				int temp = 0;
				String A = sc.next();
				String[] fruit = A.split(",");
				int a = Integer.parseInt(fruit[0]);
				int b = Integer.parseInt(fruit[1]);
				temp = T[a-1];
				T[a-1]=T[b-1];
				T[b-1]=temp;
				
			} int temp = 0; temp 0 String A = sc.next(); A sc.next() sc.next sc String[] fruit = A.split(","); fruit A.split(",") A.split A "," int a = Integer.parseInt(fruit[0]); a Integer.parseInt(fruit[0]) Integer.parseInt Integer fruit[0] fruit 0 int b = Integer.parseInt(fruit[1]); b Integer.parseInt(fruit[1]) Integer.parseInt Integer fruit[1] fruit 1 temp = T[a-1] temp T[a-1] T a-1 a 1 T[a-1]=T[b-1] T[a-1] T a-1 a 1 T[b-1] T b-1 b 1 T[b-1]=temp T[b-1] T b-1 b 1 temp for(int i = 0;i<w;i++){
				System.out.println(T[i]);
			} int i = 0; int i = 0; i 0 i<w i w i++ i++ i {
				System.out.println(T[i]);
			} {
				System.out.println(T[i]);
			} System.out.println(T[i]) System.out.println System.out System System.out T[i] T i String args[] args public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int T[] = new int[w];
		for(int i=0;i<w;i++){
				T[i]=i+1;
				//System.out.println(T[i]);
			}
		int n = sc.nextInt();
			for(int i = 0;i<n;i++ ){
				int temp = 0;
				String A = sc.next();
				String[] fruit = A.split(",");
				int a = Integer.parseInt(fruit[0]);
				int b = Integer.parseInt(fruit[1]);
				temp = T[a-1];
				T[a-1]=T[b-1];
				T[b-1]=temp;
				
			}
			for(int i = 0;i<w;i++){
				System.out.println(T[i]);
			}
	}
} public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int T[] = new int[w];
		for(int i=0;i<w;i++){
				T[i]=i+1;
				//System.out.println(T[i]);
			}
		int n = sc.nextInt();
			for(int i = 0;i<n;i++ ){
				int temp = 0;
				String A = sc.next();
				String[] fruit = A.split(",");
				int a = Integer.parseInt(fruit[0]);
				int b = Integer.parseInt(fruit[1]);
				temp = T[a-1];
				T[a-1]=T[b-1];
				T[b-1]=temp;
				
			}
			for(int i = 0;i<w;i++){
				System.out.println(T[i]);
			}
	}
} 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 T[] = new int[w];
		for(int i=0;i<w;i++){
				T[i]=i+1;
				//System.out.println(T[i]);
			}
		int n = sc.nextInt();
			for(int i = 0;i<n;i++ ){
				int temp = 0;
				String A = sc.next();
				String[] fruit = A.split(",");
				int a = Integer.parseInt(fruit[0]);
				int b = Integer.parseInt(fruit[1]);
				temp = T[a-1];
				T[a-1]=T[b-1];
				T[b-1]=temp;
				
			}
			for(int i = 0;i<w;i++){
				System.out.println(T[i]);
			}
	}
}