import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// キーボード入力
		Scanner stdIn = new Scanner( System.in );
		int w = stdIn.nextInt();//縦棒の数
		int n = stdIn.nextInt();//横棒の数
		String[] yoko = new String[n];
		for(int i=0;i<n;i++){
			yoko[i] = stdIn.next();
		}
		int[] amida = new int[w];
		for(int i=0;i<w;i++){
			amida[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] a = yoko[i].split(",");
			int[] b = {Integer.parseInt(a[0]),Integer.parseInt(a[1])};
			int temp = 0;

			temp = amida[b[0]-1];
			amida[b[0]-1] = amida[b[1]-1];
			amida[b[1]-1] = temp;
		}
		for(int i=0;i<amida.length;i++){
			System.out.println(amida[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		// キーボード入力
		Scanner stdIn = new Scanner( System.in );
		int w = stdIn.nextInt();//縦棒の数
		int n = stdIn.nextInt();//横棒の数
		String[] yoko = new String[n];
		for(int i=0;i<n;i++){
			yoko[i] = stdIn.next();
		}
		int[] amida = new int[w];
		for(int i=0;i<w;i++){
			amida[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] a = yoko[i].split(",");
			int[] b = {Integer.parseInt(a[0]),Integer.parseInt(a[1])};
			int temp = 0;

			temp = amida[b[0]-1];
			amida[b[0]-1] = amida[b[1]-1];
			amida[b[1]-1] = temp;
		}
		for(int i=0;i<amida.length;i++){
			System.out.println(amida[i]);
		}
	}
} Main public static void main(String[] args) {
		// キーボード入力
		Scanner stdIn = new Scanner( System.in );
		int w = stdIn.nextInt();//縦棒の数
		int n = stdIn.nextInt();//横棒の数
		String[] yoko = new String[n];
		for(int i=0;i<n;i++){
			yoko[i] = stdIn.next();
		}
		int[] amida = new int[w];
		for(int i=0;i<w;i++){
			amida[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] a = yoko[i].split(",");
			int[] b = {Integer.parseInt(a[0]),Integer.parseInt(a[1])};
			int temp = 0;

			temp = amida[b[0]-1];
			amida[b[0]-1] = amida[b[1]-1];
			amida[b[1]-1] = temp;
		}
		for(int i=0;i<amida.length;i++){
			System.out.println(amida[i]);
		}
	} main {
		// キーボード入力
		Scanner stdIn = new Scanner( System.in );
		int w = stdIn.nextInt();//縦棒の数
		int n = stdIn.nextInt();//横棒の数
		String[] yoko = new String[n];
		for(int i=0;i<n;i++){
			yoko[i] = stdIn.next();
		}
		int[] amida = new int[w];
		for(int i=0;i<w;i++){
			amida[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] a = yoko[i].split(",");
			int[] b = {Integer.parseInt(a[0]),Integer.parseInt(a[1])};
			int temp = 0;

			temp = amida[b[0]-1];
			amida[b[0]-1] = amida[b[1]-1];
			amida[b[1]-1] = temp;
		}
		for(int i=0;i<amida.length;i++){
			System.out.println(amida[i]);
		}
	} Scanner stdIn = new Scanner( System.in ); stdIn new Scanner( System.in ) int w = stdIn.nextInt(); w stdIn.nextInt() stdIn.nextInt stdIn int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn String[] yoko = new String[n]; yoko new String[n] n for(int i=0;i<n;i++){
			yoko[i] = stdIn.next();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			yoko[i] = stdIn.next();
		} {
			yoko[i] = stdIn.next();
		} yoko[i] = stdIn.next() yoko[i] yoko i stdIn.next() stdIn.next stdIn int[] amida = new int[w]; amida new int[w] w for(int i=0;i<w;i++){
			amida[i] = i+1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			amida[i] = i+1;
		} {
			amida[i] = i+1;
		} amida[i] = i+1 amida[i] amida i i+1 i 1 for(int i=0;i<n;i++){
			String[] a = yoko[i].split(",");
			int[] b = {Integer.parseInt(a[0]),Integer.parseInt(a[1])};
			int temp = 0;

			temp = amida[b[0]-1];
			amida[b[0]-1] = amida[b[1]-1];
			amida[b[1]-1] = temp;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String[] a = yoko[i].split(",");
			int[] b = {Integer.parseInt(a[0]),Integer.parseInt(a[1])};
			int temp = 0;

			temp = amida[b[0]-1];
			amida[b[0]-1] = amida[b[1]-1];
			amida[b[1]-1] = temp;
		} {
			String[] a = yoko[i].split(",");
			int[] b = {Integer.parseInt(a[0]),Integer.parseInt(a[1])};
			int temp = 0;

			temp = amida[b[0]-1];
			amida[b[0]-1] = amida[b[1]-1];
			amida[b[1]-1] = temp;
		} String[] a = yoko[i].split(","); a yoko[i].split(",") yoko[i].split yoko[i] yoko i "," int[] b = {Integer.parseInt(a[0]),Integer.parseInt(a[1])}; b {Integer.parseInt(a[0]),Integer.parseInt(a[1])} Integer.parseInt(a[0]) Integer.parseInt Integer a[0] a 0 Integer.parseInt(a[1]) Integer.parseInt Integer a[1] a 1 int temp = 0; temp 0 temp = amida[b[0]-1] temp amida[b[0]-1] amida b[0]-1 b[0] b 0 1 amida[b[0]-1] = amida[b[1]-1] amida[b[0]-1] amida b[0]-1 b[0] b 0 1 amida[b[1]-1] amida b[1]-1 b[1] b 1 1 amida[b[1]-1] = temp amida[b[1]-1] amida b[1]-1 b[1] b 1 1 temp for(int i=0;i<amida.length;i++){
			System.out.println(amida[i]);
		} int i=0; int i=0; i 0 i<amida.length i amida.length amida amida.length i++ i++ i {
			System.out.println(amida[i]);
		} {
			System.out.println(amida[i]);
		} System.out.println(amida[i]) System.out.println System.out System System.out amida[i] amida i String[] args args public class Main {
	public static void main(String[] args) {
		// キーボード入力
		Scanner stdIn = new Scanner( System.in );
		int w = stdIn.nextInt();//縦棒の数
		int n = stdIn.nextInt();//横棒の数
		String[] yoko = new String[n];
		for(int i=0;i<n;i++){
			yoko[i] = stdIn.next();
		}
		int[] amida = new int[w];
		for(int i=0;i<w;i++){
			amida[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] a = yoko[i].split(",");
			int[] b = {Integer.parseInt(a[0]),Integer.parseInt(a[1])};
			int temp = 0;

			temp = amida[b[0]-1];
			amida[b[0]-1] = amida[b[1]-1];
			amida[b[1]-1] = temp;
		}
		for(int i=0;i<amida.length;i++){
			System.out.println(amida[i]);
		}
	}
} public class Main {
	public static void main(String[] args) {
		// キーボード入力
		Scanner stdIn = new Scanner( System.in );
		int w = stdIn.nextInt();//縦棒の数
		int n = stdIn.nextInt();//横棒の数
		String[] yoko = new String[n];
		for(int i=0;i<n;i++){
			yoko[i] = stdIn.next();
		}
		int[] amida = new int[w];
		for(int i=0;i<w;i++){
			amida[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] a = yoko[i].split(",");
			int[] b = {Integer.parseInt(a[0]),Integer.parseInt(a[1])};
			int temp = 0;

			temp = amida[b[0]-1];
			amida[b[0]-1] = amida[b[1]-1];
			amida[b[1]-1] = temp;
		}
		for(int i=0;i<amida.length;i++){
			System.out.println(amida[i]);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// キーボード入力
		Scanner stdIn = new Scanner( System.in );
		int w = stdIn.nextInt();//縦棒の数
		int n = stdIn.nextInt();//横棒の数
		String[] yoko = new String[n];
		for(int i=0;i<n;i++){
			yoko[i] = stdIn.next();
		}
		int[] amida = new int[w];
		for(int i=0;i<w;i++){
			amida[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] a = yoko[i].split(",");
			int[] b = {Integer.parseInt(a[0]),Integer.parseInt(a[1])};
			int temp = 0;

			temp = amida[b[0]-1];
			amida[b[0]-1] = amida[b[1]-1];
			amida[b[1]-1] = temp;
		}
		for(int i=0;i<amida.length;i++){
			System.out.println(amida[i]);
		}
	}
}