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

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

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int a[] = new int[w];
		int b[] = new int[n];
		int c[] = new int[n];
		int temp = 0;
		int i = 0;
		String str;
		for(i=0;i<n;i++){
			str = sc.next();
			String[] bc = str.split(",");
			b[i] = Integer.parseInt(bc[0])-1;
			c[i] = Integer.parseInt(bc[1])-1;
		}
		for(i=0;i<w;i++){
			a[i] = i + 1;
		}
		for(i=0;i<n;i++){
			temp = a[b[i]];
			a[b[i]] = a[c[i]];
			a[c[i]] = temp;
		}
		for(i=0;i<w;i++){
			System.out.println(a[i]);
		}
	}
}