import java.util.Scanner;

public class Main {
	private static Scanner scan;
	public static void main(String[] args) {
		scan = new Scanner(System.in);
		scan.useDelimiter(",|\\s+");
		int a[] = new int[31];
		for(int i = 0;i < 31;i++){
			a[i] = i;
		}
		int w = scan.nextInt();
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){			
			int a1 = scan.nextInt();
			int a2 = scan.nextInt();
			int b1 = a[a1];
			int b2 = a[a2];
			a[a1] = b2;
			a[a2] = b1;
		}
		for(int i = 1;i <= w;i++ ){
			System.out.println(a[i]);
		}
		System.exit(0);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	private static Scanner scan;
	public static void main(String[] args) {
		scan = new Scanner(System.in);
		scan.useDelimiter(",|\\s+");
		int a[] = new int[31];
		for(int i = 0;i < 31;i++){
			a[i] = i;
		}
		int w = scan.nextInt();
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){			
			int a1 = scan.nextInt();
			int a2 = scan.nextInt();
			int b1 = a[a1];
			int b2 = a[a2];
			a[a1] = b2;
			a[a2] = b1;
		}
		for(int i = 1;i <= w;i++ ){
			System.out.println(a[i]);
		}
		System.exit(0);
	}
} Main private static Scanner scan; scan public static void main(String[] args) {
		scan = new Scanner(System.in);
		scan.useDelimiter(",|\\s+");
		int a[] = new int[31];
		for(int i = 0;i < 31;i++){
			a[i] = i;
		}
		int w = scan.nextInt();
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){			
			int a1 = scan.nextInt();
			int a2 = scan.nextInt();
			int b1 = a[a1];
			int b2 = a[a2];
			a[a1] = b2;
			a[a2] = b1;
		}
		for(int i = 1;i <= w;i++ ){
			System.out.println(a[i]);
		}
		System.exit(0);
	} main {
		scan = new Scanner(System.in);
		scan.useDelimiter(",|\\s+");
		int a[] = new int[31];
		for(int i = 0;i < 31;i++){
			a[i] = i;
		}
		int w = scan.nextInt();
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){			
			int a1 = scan.nextInt();
			int a2 = scan.nextInt();
			int b1 = a[a1];
			int b2 = a[a2];
			a[a1] = b2;
			a[a2] = b1;
		}
		for(int i = 1;i <= w;i++ ){
			System.out.println(a[i]);
		}
		System.exit(0);
	} scan = new Scanner(System.in) scan new Scanner(System.in) scan.useDelimiter(",|\\s+") scan.useDelimiter scan ",|\\s+" int a[] = new int[31]; a new int[31] 31 for(int i = 0;i < 31;i++){
			a[i] = i;
		} int i = 0; int i = 0; i 0 i < 31 i 31 i++ i++ i {
			a[i] = i;
		} {
			a[i] = i;
		} a[i] = i a[i] a i i int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan for(int i = 0;i < n;i++){			
			int a1 = scan.nextInt();
			int a2 = scan.nextInt();
			int b1 = a[a1];
			int b2 = a[a2];
			a[a1] = b2;
			a[a2] = b1;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {			
			int a1 = scan.nextInt();
			int a2 = scan.nextInt();
			int b1 = a[a1];
			int b2 = a[a2];
			a[a1] = b2;
			a[a2] = b1;
		} {			
			int a1 = scan.nextInt();
			int a2 = scan.nextInt();
			int b1 = a[a1];
			int b2 = a[a2];
			a[a1] = b2;
			a[a2] = b1;
		} int a1 = scan.nextInt(); a1 scan.nextInt() scan.nextInt scan int a2 = scan.nextInt(); a2 scan.nextInt() scan.nextInt scan int b1 = a[a1]; b1 a[a1] a a1 int b2 = a[a2]; b2 a[a2] a a2 a[a1] = b2 a[a1] a a1 b2 a[a2] = b1 a[a2] a a2 b1 for(int i = 1;i <= w;i++ ){
			System.out.println(a[i]);
		} int i = 1; int i = 1; i 1 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 System.exit(0) System.exit System 0 String[] args args public class Main {
	private static Scanner scan;
	public static void main(String[] args) {
		scan = new Scanner(System.in);
		scan.useDelimiter(",|\\s+");
		int a[] = new int[31];
		for(int i = 0;i < 31;i++){
			a[i] = i;
		}
		int w = scan.nextInt();
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){			
			int a1 = scan.nextInt();
			int a2 = scan.nextInt();
			int b1 = a[a1];
			int b2 = a[a2];
			a[a1] = b2;
			a[a2] = b1;
		}
		for(int i = 1;i <= w;i++ ){
			System.out.println(a[i]);
		}
		System.exit(0);
	}
} public class Main {
	private static Scanner scan;
	public static void main(String[] args) {
		scan = new Scanner(System.in);
		scan.useDelimiter(",|\\s+");
		int a[] = new int[31];
		for(int i = 0;i < 31;i++){
			a[i] = i;
		}
		int w = scan.nextInt();
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){			
			int a1 = scan.nextInt();
			int a2 = scan.nextInt();
			int b1 = a[a1];
			int b2 = a[a2];
			a[a1] = b2;
			a[a2] = b1;
		}
		for(int i = 1;i <= w;i++ ){
			System.out.println(a[i]);
		}
		System.exit(0);
	}
} Main
import java.util.Scanner;

public class Main {
	private static Scanner scan;
	public static void main(String[] args) {
		scan = new Scanner(System.in);
		scan.useDelimiter(",|\\s+");
		int a[] = new int[31];
		for(int i = 0;i < 31;i++){
			a[i] = i;
		}
		int w = scan.nextInt();
		int n = scan.nextInt();
		for(int i = 0;i < n;i++){			
			int a1 = scan.nextInt();
			int a2 = scan.nextInt();
			int b1 = a[a1];
			int b2 = a[a2];
			a[a1] = b2;
			a[a2] = b1;
		}
		for(int i = 1;i <= w;i++ ){
			System.out.println(a[i]);
		}
		System.exit(0);
	}
}