import java.util.Scanner;


public class Main{
public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int w=Integer.valueOf(scan.nextLine());
	int n=Integer.valueOf(scan.nextLine());
	int[] a=new int[n];
	int[] b=new int[n];
	int[] lots=new int[w+1];
	int temp;

	for(int i=1;i<lots.length;i++){
		lots[i]=i;
	}
	for(int i=0;i<n;i++){
		String str=scan.nextLine();
		String[] s=str.split(",");
		a[i]=Integer.valueOf(s[0]);
		b[i]=Integer.valueOf(s[1]);

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


	}

} import java.util.Scanner; Scanner java.util public class Main{
public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int w=Integer.valueOf(scan.nextLine());
	int n=Integer.valueOf(scan.nextLine());
	int[] a=new int[n];
	int[] b=new int[n];
	int[] lots=new int[w+1];
	int temp;

	for(int i=1;i<lots.length;i++){
		lots[i]=i;
	}
	for(int i=0;i<n;i++){
		String str=scan.nextLine();
		String[] s=str.split(",");
		a[i]=Integer.valueOf(s[0]);
		b[i]=Integer.valueOf(s[1]);

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


	}

} Main public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int w=Integer.valueOf(scan.nextLine());
	int n=Integer.valueOf(scan.nextLine());
	int[] a=new int[n];
	int[] b=new int[n];
	int[] lots=new int[w+1];
	int temp;

	for(int i=1;i<lots.length;i++){
		lots[i]=i;
	}
	for(int i=0;i<n;i++){
		String str=scan.nextLine();
		String[] s=str.split(",");
		a[i]=Integer.valueOf(s[0]);
		b[i]=Integer.valueOf(s[1]);

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


	} main {
	Scanner scan = new Scanner(System.in);
	int w=Integer.valueOf(scan.nextLine());
	int n=Integer.valueOf(scan.nextLine());
	int[] a=new int[n];
	int[] b=new int[n];
	int[] lots=new int[w+1];
	int temp;

	for(int i=1;i<lots.length;i++){
		lots[i]=i;
	}
	for(int i=0;i<n;i++){
		String str=scan.nextLine();
		String[] s=str.split(",");
		a[i]=Integer.valueOf(s[0]);
		b[i]=Integer.valueOf(s[1]);

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


	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w=Integer.valueOf(scan.nextLine()); w Integer.valueOf(scan.nextLine()) Integer.valueOf Integer scan.nextLine() scan.nextLine scan int n=Integer.valueOf(scan.nextLine()); n Integer.valueOf(scan.nextLine()) Integer.valueOf Integer scan.nextLine() scan.nextLine scan int[] a=new int[n]; a new int[n] n int[] b=new int[n]; b new int[n] n int[] lots=new int[w+1]; lots new int[w+1] w+1 w 1 int temp; temp for(int i=1;i<lots.length;i++){
		lots[i]=i;
	} int i=1; int i=1; i 1 i<lots.length i lots.length lots lots.length i++ i++ i {
		lots[i]=i;
	} {
		lots[i]=i;
	} lots[i]=i lots[i] lots i i for(int i=0;i<n;i++){
		String str=scan.nextLine();
		String[] s=str.split(",");
		a[i]=Integer.valueOf(s[0]);
		b[i]=Integer.valueOf(s[1]);

		temp=lots[a[i]];
		lots[a[i]]=lots[b[i]];
		lots[b[i]]=temp;
	} int i=0; int i=0; i 0 i<n i n i++ i++ i {
		String str=scan.nextLine();
		String[] s=str.split(",");
		a[i]=Integer.valueOf(s[0]);
		b[i]=Integer.valueOf(s[1]);

		temp=lots[a[i]];
		lots[a[i]]=lots[b[i]];
		lots[b[i]]=temp;
	} {
		String str=scan.nextLine();
		String[] s=str.split(",");
		a[i]=Integer.valueOf(s[0]);
		b[i]=Integer.valueOf(s[1]);

		temp=lots[a[i]];
		lots[a[i]]=lots[b[i]];
		lots[b[i]]=temp;
	} String str=scan.nextLine(); str scan.nextLine() scan.nextLine scan String[] s=str.split(","); s str.split(",") str.split str "," a[i]=Integer.valueOf(s[0]) a[i] a i Integer.valueOf(s[0]) Integer.valueOf Integer s[0] s 0 b[i]=Integer.valueOf(s[1]) b[i] b i Integer.valueOf(s[1]) Integer.valueOf Integer s[1] s 1 temp=lots[a[i]] temp lots[a[i]] lots a[i] a i lots[a[i]]=lots[b[i]] lots[a[i]] lots a[i] a i lots[b[i]] lots b[i] b i lots[b[i]]=temp lots[b[i]] lots b[i] b i temp for(int i=1;i<lots.length;i++){
		System.out.println(lots[i]);
	} int i=1; int i=1; i 1 i<lots.length i lots.length lots lots.length i++ i++ i {
		System.out.println(lots[i]);
	} {
		System.out.println(lots[i]);
	} System.out.println(lots[i]) System.out.println System.out System System.out lots[i] lots i String[] args args public class Main{
public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int w=Integer.valueOf(scan.nextLine());
	int n=Integer.valueOf(scan.nextLine());
	int[] a=new int[n];
	int[] b=new int[n];
	int[] lots=new int[w+1];
	int temp;

	for(int i=1;i<lots.length;i++){
		lots[i]=i;
	}
	for(int i=0;i<n;i++){
		String str=scan.nextLine();
		String[] s=str.split(",");
		a[i]=Integer.valueOf(s[0]);
		b[i]=Integer.valueOf(s[1]);

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


	}

} public class Main{
public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int w=Integer.valueOf(scan.nextLine());
	int n=Integer.valueOf(scan.nextLine());
	int[] a=new int[n];
	int[] b=new int[n];
	int[] lots=new int[w+1];
	int temp;

	for(int i=1;i<lots.length;i++){
		lots[i]=i;
	}
	for(int i=0;i<n;i++){
		String str=scan.nextLine();
		String[] s=str.split(",");
		a[i]=Integer.valueOf(s[0]);
		b[i]=Integer.valueOf(s[1]);

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


	}

} Main
import java.util.Scanner;


public class Main{
public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int w=Integer.valueOf(scan.nextLine());
	int n=Integer.valueOf(scan.nextLine());
	int[] a=new int[n];
	int[] b=new int[n];
	int[] lots=new int[w+1];
	int temp;

	for(int i=1;i<lots.length;i++){
		lots[i]=i;
	}
	for(int i=0;i<n;i++){
		String str=scan.nextLine();
		String[] s=str.split(",");
		a[i]=Integer.valueOf(s[0]);
		b[i]=Integer.valueOf(s[1]);

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


	}

}