import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		doIt();
	}
	public static void doIt(){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] hor = new int[n][2];
		for(int i = 0; i < n; i++){
			String str = sc.next();
			String[] ss = str.split(",");
			//System.out.println(str);
			hor[i][0] = Integer.parseInt(ss[0]);
			//System.out.println(hor[i][0]);
			hor[i][1] = Integer.parseInt(ss[1]);
			//System.out.println(hor[i][1]);
		}
		
		int[] ver = new int[w];
		for(int i = 1; i <= w; i++){
			int num = i;
			for(int j = 0; j < n; j++){
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			}
			//System.out.println(num);
			ver[num - 1] = i;
		}
		for(int i = 0; i < w; i++){
			System.out.println(ver[i]);
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		doIt();
	}
	public static void doIt(){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] hor = new int[n][2];
		for(int i = 0; i < n; i++){
			String str = sc.next();
			String[] ss = str.split(",");
			//System.out.println(str);
			hor[i][0] = Integer.parseInt(ss[0]);
			//System.out.println(hor[i][0]);
			hor[i][1] = Integer.parseInt(ss[1]);
			//System.out.println(hor[i][1]);
		}
		
		int[] ver = new int[w];
		for(int i = 1; i <= w; i++){
			int num = i;
			for(int j = 0; j < n; j++){
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			}
			//System.out.println(num);
			ver[num - 1] = i;
		}
		for(int i = 0; i < w; i++){
			System.out.println(ver[i]);
		}
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		doIt();
	} main {
		// TODO Auto-generated method stub
		doIt();
	} doIt() doIt String[] args args public static void doIt(){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] hor = new int[n][2];
		for(int i = 0; i < n; i++){
			String str = sc.next();
			String[] ss = str.split(",");
			//System.out.println(str);
			hor[i][0] = Integer.parseInt(ss[0]);
			//System.out.println(hor[i][0]);
			hor[i][1] = Integer.parseInt(ss[1]);
			//System.out.println(hor[i][1]);
		}
		
		int[] ver = new int[w];
		for(int i = 1; i <= w; i++){
			int num = i;
			for(int j = 0; j < n; j++){
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			}
			//System.out.println(num);
			ver[num - 1] = i;
		}
		for(int i = 0; i < w; i++){
			System.out.println(ver[i]);
		}
	} doIt {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] hor = new int[n][2];
		for(int i = 0; i < n; i++){
			String str = sc.next();
			String[] ss = str.split(",");
			//System.out.println(str);
			hor[i][0] = Integer.parseInt(ss[0]);
			//System.out.println(hor[i][0]);
			hor[i][1] = Integer.parseInt(ss[1]);
			//System.out.println(hor[i][1]);
		}
		
		int[] ver = new int[w];
		for(int i = 1; i <= w; i++){
			int num = i;
			for(int j = 0; j < n; j++){
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			}
			//System.out.println(num);
			ver[num - 1] = i;
		}
		for(int i = 0; i < w; i++){
			System.out.println(ver[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[][] hor = new int[n][2]; hor new int[n][2] n 2 for(int i = 0; i < n; i++){
			String str = sc.next();
			String[] ss = str.split(",");
			//System.out.println(str);
			hor[i][0] = Integer.parseInt(ss[0]);
			//System.out.println(hor[i][0]);
			hor[i][1] = Integer.parseInt(ss[1]);
			//System.out.println(hor[i][1]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String str = sc.next();
			String[] ss = str.split(",");
			//System.out.println(str);
			hor[i][0] = Integer.parseInt(ss[0]);
			//System.out.println(hor[i][0]);
			hor[i][1] = Integer.parseInt(ss[1]);
			//System.out.println(hor[i][1]);
		} {
			String str = sc.next();
			String[] ss = str.split(",");
			//System.out.println(str);
			hor[i][0] = Integer.parseInt(ss[0]);
			//System.out.println(hor[i][0]);
			hor[i][1] = Integer.parseInt(ss[1]);
			//System.out.println(hor[i][1]);
		} String str = sc.next(); str sc.next() sc.next sc String[] ss = str.split(","); ss str.split(",") str.split str "," hor[i][0] = Integer.parseInt(ss[0]) hor[i][0] hor[i] hor i 0 Integer.parseInt(ss[0]) Integer.parseInt Integer ss[0] ss 0 hor[i][1] = Integer.parseInt(ss[1]) hor[i][1] hor[i] hor i 1 Integer.parseInt(ss[1]) Integer.parseInt Integer ss[1] ss 1 int[] ver = new int[w]; ver new int[w] w for(int i = 1; i <= w; i++){
			int num = i;
			for(int j = 0; j < n; j++){
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			}
			//System.out.println(num);
			ver[num - 1] = i;
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			int num = i;
			for(int j = 0; j < n; j++){
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			}
			//System.out.println(num);
			ver[num - 1] = i;
		} {
			int num = i;
			for(int j = 0; j < n; j++){
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			}
			//System.out.println(num);
			ver[num - 1] = i;
		} int num = i; num i for(int j = 0; j < n; j++){
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			} {
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			} if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				} num == hor[j][0] num hor[j][0] hor[j] hor j 0 {
					num = hor[j][1];
				} num = hor[j][1] num hor[j][1] hor[j] hor j 1 if(num == hor[j][1]){
					num = hor[j][0];
				} num == hor[j][1] num hor[j][1] hor[j] hor j 1 {
					num = hor[j][0];
				} num = hor[j][0] num hor[j][0] hor[j] hor j 0 ver[num - 1] = i ver[num - 1] ver num - 1 num 1 i for(int i = 0; i < w; i++){
			System.out.println(ver[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(ver[i]);
		} {
			System.out.println(ver[i]);
		} System.out.println(ver[i]) System.out.println System.out System System.out ver[i] ver i public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		doIt();
	}
	public static void doIt(){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] hor = new int[n][2];
		for(int i = 0; i < n; i++){
			String str = sc.next();
			String[] ss = str.split(",");
			//System.out.println(str);
			hor[i][0] = Integer.parseInt(ss[0]);
			//System.out.println(hor[i][0]);
			hor[i][1] = Integer.parseInt(ss[1]);
			//System.out.println(hor[i][1]);
		}
		
		int[] ver = new int[w];
		for(int i = 1; i <= w; i++){
			int num = i;
			for(int j = 0; j < n; j++){
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			}
			//System.out.println(num);
			ver[num - 1] = i;
		}
		for(int i = 0; i < w; i++){
			System.out.println(ver[i]);
		}
	}

} public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		doIt();
	}
	public static void doIt(){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] hor = new int[n][2];
		for(int i = 0; i < n; i++){
			String str = sc.next();
			String[] ss = str.split(",");
			//System.out.println(str);
			hor[i][0] = Integer.parseInt(ss[0]);
			//System.out.println(hor[i][0]);
			hor[i][1] = Integer.parseInt(ss[1]);
			//System.out.println(hor[i][1]);
		}
		
		int[] ver = new int[w];
		for(int i = 1; i <= w; i++){
			int num = i;
			for(int j = 0; j < n; j++){
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			}
			//System.out.println(num);
			ver[num - 1] = i;
		}
		for(int i = 0; i < w; i++){
			System.out.println(ver[i]);
		}
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		doIt();
	}
	public static void doIt(){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[][] hor = new int[n][2];
		for(int i = 0; i < n; i++){
			String str = sc.next();
			String[] ss = str.split(",");
			//System.out.println(str);
			hor[i][0] = Integer.parseInt(ss[0]);
			//System.out.println(hor[i][0]);
			hor[i][1] = Integer.parseInt(ss[1]);
			//System.out.println(hor[i][1]);
		}
		
		int[] ver = new int[w];
		for(int i = 1; i <= w; i++){
			int num = i;
			for(int j = 0; j < n; j++){
				if(num == hor[j][0]){
					num = hor[j][1];
				}
				else if(num == hor[j][1]){
					num = hor[j][0];
				}
			}
			//System.out.println(num);
			ver[num - 1] = i;
		}
		for(int i = 0; i < w; i++){
			System.out.println(ver[i]);
		}
	}

}