import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] num =new int[w];
		for(int i=0;i<w;i++){
			num[i]=i+1;
		}

		String [][] scombo =new String[n][2];
		int [][] combo =new int[n][2];

		//??\?????????????????¨????????\?????????????????§????????????
		for(int i=0;i<n;i++){
			String str =sc.next();
			scombo[i]=str.split(",");
		}



		//????????????????????°??????????????????
		for(int i=0;i<n;i++){
			for(int j=0;j<2;j++){
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			}
		}
		//????????????
		for(int i=0;i<n;i++){
			int x = num[combo[i][0]-1];
			num[combo[i][0]-1]=num[combo[i][1]-1];
			num[combo[i][1]-1]=x;
		}
		//??????
		for(int i=0;i<w;i++){
			System.out.println(num[i]);
		}


	}

} import java.util.Scanner; Scanner java.util public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] num =new int[w];
		for(int i=0;i<w;i++){
			num[i]=i+1;
		}

		String [][] scombo =new String[n][2];
		int [][] combo =new int[n][2];

		//??\?????????????????¨????????\?????????????????§????????????
		for(int i=0;i<n;i++){
			String str =sc.next();
			scombo[i]=str.split(",");
		}



		//????????????????????°??????????????????
		for(int i=0;i<n;i++){
			for(int j=0;j<2;j++){
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			}
		}
		//????????????
		for(int i=0;i<n;i++){
			int x = num[combo[i][0]-1];
			num[combo[i][0]-1]=num[combo[i][1]-1];
			num[combo[i][1]-1]=x;
		}
		//??????
		for(int i=0;i<w;i++){
			System.out.println(num[i]);
		}


	}

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] num =new int[w];
		for(int i=0;i<w;i++){
			num[i]=i+1;
		}

		String [][] scombo =new String[n][2];
		int [][] combo =new int[n][2];

		//??\?????????????????¨????????\?????????????????§????????????
		for(int i=0;i<n;i++){
			String str =sc.next();
			scombo[i]=str.split(",");
		}



		//????????????????????°??????????????????
		for(int i=0;i<n;i++){
			for(int j=0;j<2;j++){
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			}
		}
		//????????????
		for(int i=0;i<n;i++){
			int x = num[combo[i][0]-1];
			num[combo[i][0]-1]=num[combo[i][1]-1];
			num[combo[i][1]-1]=x;
		}
		//??????
		for(int i=0;i<w;i++){
			System.out.println(num[i]);
		}


	} main {
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] num =new int[w];
		for(int i=0;i<w;i++){
			num[i]=i+1;
		}

		String [][] scombo =new String[n][2];
		int [][] combo =new int[n][2];

		//??\?????????????????¨????????\?????????????????§????????????
		for(int i=0;i<n;i++){
			String str =sc.next();
			scombo[i]=str.split(",");
		}



		//????????????????????°??????????????????
		for(int i=0;i<n;i++){
			for(int j=0;j<2;j++){
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			}
		}
		//????????????
		for(int i=0;i<n;i++){
			int x = num[combo[i][0]-1];
			num[combo[i][0]-1]=num[combo[i][1]-1];
			num[combo[i][1]-1]=x;
		}
		//??????
		for(int i=0;i<w;i++){
			System.out.println(num[i]);
		}


	} int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] num =new int[w]; num new int[w] w for(int i=0;i<w;i++){
			num[i]=i+1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			num[i]=i+1;
		} {
			num[i]=i+1;
		} num[i]=i+1 num[i] num i i+1 i 1 String [][] scombo =new String[n][2]; scombo new String[n][2] n 2 int [][] combo =new int[n][2]; combo new int[n][2] n 2 for(int i=0;i<n;i++){
			String str =sc.next();
			scombo[i]=str.split(",");
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String str =sc.next();
			scombo[i]=str.split(",");
		} {
			String str =sc.next();
			scombo[i]=str.split(",");
		} String str =sc.next(); str sc.next() sc.next sc scombo[i]=str.split(",") scombo[i] scombo i str.split(",") str.split str "," for(int i=0;i<n;i++){
			for(int j=0;j<2;j++){
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			for(int j=0;j<2;j++){
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			}
		} {
			for(int j=0;j<2;j++){
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			}
		} for(int j=0;j<2;j++){
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			} int j=0; int j=0; j 0 j<2 j 2 j++ j++ j {
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			} {
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			} combo[i][j]=Integer.parseInt(scombo[i][j]) combo[i][j] combo[i] combo i j Integer.parseInt(scombo[i][j]) Integer.parseInt Integer scombo[i][j] scombo[i] scombo i j for(int i=0;i<n;i++){
			int x = num[combo[i][0]-1];
			num[combo[i][0]-1]=num[combo[i][1]-1];
			num[combo[i][1]-1]=x;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			int x = num[combo[i][0]-1];
			num[combo[i][0]-1]=num[combo[i][1]-1];
			num[combo[i][1]-1]=x;
		} {
			int x = num[combo[i][0]-1];
			num[combo[i][0]-1]=num[combo[i][1]-1];
			num[combo[i][1]-1]=x;
		} int x = num[combo[i][0]-1]; x num[combo[i][0]-1] num combo[i][0]-1 combo[i][0] combo[i] combo i 0 1 num[combo[i][0]-1]=num[combo[i][1]-1] num[combo[i][0]-1] num combo[i][0]-1 combo[i][0] combo[i] combo i 0 1 num[combo[i][1]-1] num combo[i][1]-1 combo[i][1] combo[i] combo i 1 1 num[combo[i][1]-1]=x num[combo[i][1]-1] num combo[i][1]-1 combo[i][1] combo[i] combo i 1 1 x for(int i=0;i<w;i++){
			System.out.println(num[i]);
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			System.out.println(num[i]);
		} {
			System.out.println(num[i]);
		} System.out.println(num[i]) System.out.println System.out System System.out num[i] num i String[] args args public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] num =new int[w];
		for(int i=0;i<w;i++){
			num[i]=i+1;
		}

		String [][] scombo =new String[n][2];
		int [][] combo =new int[n][2];

		//??\?????????????????¨????????\?????????????????§????????????
		for(int i=0;i<n;i++){
			String str =sc.next();
			scombo[i]=str.split(",");
		}



		//????????????????????°??????????????????
		for(int i=0;i<n;i++){
			for(int j=0;j<2;j++){
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			}
		}
		//????????????
		for(int i=0;i<n;i++){
			int x = num[combo[i][0]-1];
			num[combo[i][0]-1]=num[combo[i][1]-1];
			num[combo[i][1]-1]=x;
		}
		//??????
		for(int i=0;i<w;i++){
			System.out.println(num[i]);
		}


	}

} public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] num =new int[w];
		for(int i=0;i<w;i++){
			num[i]=i+1;
		}

		String [][] scombo =new String[n][2];
		int [][] combo =new int[n][2];

		//??\?????????????????¨????????\?????????????????§????????????
		for(int i=0;i<n;i++){
			String str =sc.next();
			scombo[i]=str.split(",");
		}



		//????????????????????°??????????????????
		for(int i=0;i<n;i++){
			for(int j=0;j<2;j++){
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			}
		}
		//????????????
		for(int i=0;i<n;i++){
			int x = num[combo[i][0]-1];
			num[combo[i][0]-1]=num[combo[i][1]-1];
			num[combo[i][1]-1]=x;
		}
		//??????
		for(int i=0;i<w;i++){
			System.out.println(num[i]);
		}


	}

} Main
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] num =new int[w];
		for(int i=0;i<w;i++){
			num[i]=i+1;
		}

		String [][] scombo =new String[n][2];
		int [][] combo =new int[n][2];

		//??\?????????????????¨????????\?????????????????§????????????
		for(int i=0;i<n;i++){
			String str =sc.next();
			scombo[i]=str.split(",");
		}



		//????????????????????°??????????????????
		for(int i=0;i<n;i++){
			for(int j=0;j<2;j++){
				combo[i][j]=Integer.parseInt(scombo[i][j]);
			}
		}
		//????????????
		for(int i=0;i<n;i++){
			int x = num[combo[i][0]-1];
			num[combo[i][0]-1]=num[combo[i][1]-1];
			num[combo[i][1]-1]=x;
		}
		//??????
		for(int i=0;i<w;i++){
			System.out.println(num[i]);
		}


	}

}