import java.util.*;

public class Main {
	
	public static String[] kommaReader(String sc) {
		String line = sc;
		String[] array = line.split(",");
		return array;
	}

	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+1];
		for(int i=1; i<=w; i++) a[i]=i;
		for(int i=0; i<n; i++){
			String text = sc.next();
			String[] ch = kommaReader(text);
			int x = Integer.parseInt(ch[0]);
			int y = Integer.parseInt(ch[1]);
			int t = a[x]; 
			a[x] = a[y];
			a[y] = t;
		}
		for(int i=1; i<=w; i++) System.out.println(a[i]);
	}

} import java.util.*; util.* java public class Main {
	
	public static String[] kommaReader(String sc) {
		String line = sc;
		String[] array = line.split(",");
		return array;
	}

	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+1];
		for(int i=1; i<=w; i++) a[i]=i;
		for(int i=0; i<n; i++){
			String text = sc.next();
			String[] ch = kommaReader(text);
			int x = Integer.parseInt(ch[0]);
			int y = Integer.parseInt(ch[1]);
			int t = a[x]; 
			a[x] = a[y];
			a[y] = t;
		}
		for(int i=1; i<=w; i++) System.out.println(a[i]);
	}

} Main public static String[] kommaReader(String sc) {
		String line = sc;
		String[] array = line.split(",");
		return array;
	} kommaReader {
		String line = sc;
		String[] array = line.split(",");
		return array;
	} String line = sc; line sc String[] array = line.split(","); array line.split(",") line.split line "," return array; array String sc sc 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+1];
		for(int i=1; i<=w; i++) a[i]=i;
		for(int i=0; i<n; i++){
			String text = sc.next();
			String[] ch = kommaReader(text);
			int x = Integer.parseInt(ch[0]);
			int y = Integer.parseInt(ch[1]);
			int t = a[x]; 
			a[x] = a[y];
			a[y] = t;
		}
		for(int i=1; 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+1];
		for(int i=1; i<=w; i++) a[i]=i;
		for(int i=0; i<n; i++){
			String text = sc.next();
			String[] ch = kommaReader(text);
			int x = Integer.parseInt(ch[0]);
			int y = Integer.parseInt(ch[1]);
			int t = a[x]; 
			a[x] = a[y];
			a[y] = t;
		}
		for(int i=1; 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+1]; a new int[w+1] w+1 w 1 for(int i=1; i<=w; i++) a[i]=i; int i=1; int i=1; i 1 i<=w i w i++ i++ i a[i]=i; a[i]=i a[i] a i i for(int i=0; i<n; i++){
			String text = sc.next();
			String[] ch = kommaReader(text);
			int x = Integer.parseInt(ch[0]);
			int y = Integer.parseInt(ch[1]);
			int t = a[x]; 
			a[x] = a[y];
			a[y] = t;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String text = sc.next();
			String[] ch = kommaReader(text);
			int x = Integer.parseInt(ch[0]);
			int y = Integer.parseInt(ch[1]);
			int t = a[x]; 
			a[x] = a[y];
			a[y] = t;
		} {
			String text = sc.next();
			String[] ch = kommaReader(text);
			int x = Integer.parseInt(ch[0]);
			int y = Integer.parseInt(ch[1]);
			int t = a[x]; 
			a[x] = a[y];
			a[y] = t;
		} String text = sc.next(); text sc.next() sc.next sc String[] ch = kommaReader(text); ch kommaReader(text) kommaReader text int x = Integer.parseInt(ch[0]); x Integer.parseInt(ch[0]) Integer.parseInt Integer ch[0] ch 0 int y = Integer.parseInt(ch[1]); y Integer.parseInt(ch[1]) Integer.parseInt Integer ch[1] ch 1 int t = a[x]; t a[x] a x a[x] = a[y] a[x] a x a[y] a y a[y] = t a[y] a y t for(int i=1; i<=w; i++) System.out.println(a[i]); int i=1; int i=1; i 1 i<=w i w i++ i++ 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 String[] kommaReader(String sc) {
		String line = sc;
		String[] array = line.split(",");
		return array;
	}

	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+1];
		for(int i=1; i<=w; i++) a[i]=i;
		for(int i=0; i<n; i++){
			String text = sc.next();
			String[] ch = kommaReader(text);
			int x = Integer.parseInt(ch[0]);
			int y = Integer.parseInt(ch[1]);
			int t = a[x]; 
			a[x] = a[y];
			a[y] = t;
		}
		for(int i=1; i<=w; i++) System.out.println(a[i]);
	}

} public class Main {
	
	public static String[] kommaReader(String sc) {
		String line = sc;
		String[] array = line.split(",");
		return array;
	}

	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+1];
		for(int i=1; i<=w; i++) a[i]=i;
		for(int i=0; i<n; i++){
			String text = sc.next();
			String[] ch = kommaReader(text);
			int x = Integer.parseInt(ch[0]);
			int y = Integer.parseInt(ch[1]);
			int t = a[x]; 
			a[x] = a[y];
			a[y] = t;
		}
		for(int i=1; i<=w; i++) System.out.println(a[i]);
	}

} Main
import java.util.*;

public class Main {
	
	public static String[] kommaReader(String sc) {
		String line = sc;
		String[] array = line.split(",");
		return array;
	}

	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+1];
		for(int i=1; i<=w; i++) a[i]=i;
		for(int i=0; i<n; i++){
			String text = sc.next();
			String[] ch = kommaReader(text);
			int x = Integer.parseInt(ch[0]);
			int y = Integer.parseInt(ch[1]);
			int t = a[x]; 
			a[x] = a[y];
			a[y] = t;
		}
		for(int i=1; i<=w; i++) System.out.println(a[i]);
	}

}