import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter("\\D+");

		int w = scan.nextInt();
		int n = scan.nextInt();
		
		int[] a = new int[w];
		for(int i=0;i<w;i++)
			a[i] = i+1;
		
		for(int i=0;i<n;i++) {
			int x = scan.nextInt()-1;
			int y = scan.nextInt()-1;
			
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(a[i]);
		}
		
		scan.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter("\\D+");

		int w = scan.nextInt();
		int n = scan.nextInt();
		
		int[] a = new int[w];
		for(int i=0;i<w;i++)
			a[i] = i+1;
		
		for(int i=0;i<n;i++) {
			int x = scan.nextInt()-1;
			int y = scan.nextInt()-1;
			
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(a[i]);
		}
		
		scan.close();
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter("\\D+");

		int w = scan.nextInt();
		int n = scan.nextInt();
		
		int[] a = new int[w];
		for(int i=0;i<w;i++)
			a[i] = i+1;
		
		for(int i=0;i<n;i++) {
			int x = scan.nextInt()-1;
			int y = scan.nextInt()-1;
			
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(a[i]);
		}
		
		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter("\\D+");

		int w = scan.nextInt();
		int n = scan.nextInt();
		
		int[] a = new int[w];
		for(int i=0;i<w;i++)
			a[i] = i+1;
		
		for(int i=0;i<n;i++) {
			int x = scan.nextInt()-1;
			int y = scan.nextInt()-1;
			
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(a[i]);
		}
		
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) scan.useDelimiter("\\D+") scan.useDelimiter scan "\\D+" int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] a = new int[w]; a new int[w] w for(int i=0;i<w;i++)
			a[i] = i+1; int i=0; int i=0; i 0 i<w i w i++ i++ i a[i] = i+1; a[i] = i+1 a[i] a i i+1 i 1 for(int i=0;i<n;i++) {
			int x = scan.nextInt()-1;
			int y = scan.nextInt()-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 {
			int x = scan.nextInt()-1;
			int y = scan.nextInt()-1;
			
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		} {
			int x = scan.nextInt()-1;
			int y = scan.nextInt()-1;
			
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		} int x = scan.nextInt()-1; x scan.nextInt()-1 scan.nextInt() scan.nextInt scan 1 int y = scan.nextInt()-1; y scan.nextInt()-1 scan.nextInt() scan.nextInt scan 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=0;i<w;i++){
			System.out.println(a[i]);
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			System.out.println(a[i]);
		} {
			System.out.println(a[i]);
		} System.out.println(a[i]) System.out.println System.out System System.out a[i] a i scan.close() scan.close scan String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter("\\D+");

		int w = scan.nextInt();
		int n = scan.nextInt();
		
		int[] a = new int[w];
		for(int i=0;i<w;i++)
			a[i] = i+1;
		
		for(int i=0;i<n;i++) {
			int x = scan.nextInt()-1;
			int y = scan.nextInt()-1;
			
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(a[i]);
		}
		
		scan.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter("\\D+");

		int w = scan.nextInt();
		int n = scan.nextInt();
		
		int[] a = new int[w];
		for(int i=0;i<w;i++)
			a[i] = i+1;
		
		for(int i=0;i<n;i++) {
			int x = scan.nextInt()-1;
			int y = scan.nextInt()-1;
			
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(a[i]);
		}
		
		scan.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter("\\D+");

		int w = scan.nextInt();
		int n = scan.nextInt();
		
		int[] a = new int[w];
		for(int i=0;i<w;i++)
			a[i] = i+1;
		
		for(int i=0;i<n;i++) {
			int x = scan.nextInt()-1;
			int y = scan.nextInt()-1;
			
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(a[i]);
		}
		
		scan.close();
	}
}