import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\n");
		
		int VirticalLines = scan.nextInt();
		int hoirizontalLines = scan.nextInt();

		int[] lineNumber = new int[VirticalLines + 1];
		for(int i = 1; i <= VirticalLines; i++) lineNumber[i] = i;

		for(int i = 0; i < hoirizontalLines; i++) {
			int a = scan.nextInt();
			int b = scan.nextInt();
			
			int tmp = lineNumber[a];
			lineNumber[a] = lineNumber[b];
			lineNumber[b] = tmp;
		}
		
		for(int i = 1; i <= VirticalLines; i++) System.out.println(lineNumber[i]);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\n");
		
		int VirticalLines = scan.nextInt();
		int hoirizontalLines = scan.nextInt();

		int[] lineNumber = new int[VirticalLines + 1];
		for(int i = 1; i <= VirticalLines; i++) lineNumber[i] = i;

		for(int i = 0; i < hoirizontalLines; i++) {
			int a = scan.nextInt();
			int b = scan.nextInt();
			
			int tmp = lineNumber[a];
			lineNumber[a] = lineNumber[b];
			lineNumber[b] = tmp;
		}
		
		for(int i = 1; i <= VirticalLines; i++) System.out.println(lineNumber[i]);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\n");
		
		int VirticalLines = scan.nextInt();
		int hoirizontalLines = scan.nextInt();

		int[] lineNumber = new int[VirticalLines + 1];
		for(int i = 1; i <= VirticalLines; i++) lineNumber[i] = i;

		for(int i = 0; i < hoirizontalLines; i++) {
			int a = scan.nextInt();
			int b = scan.nextInt();
			
			int tmp = lineNumber[a];
			lineNumber[a] = lineNumber[b];
			lineNumber[b] = tmp;
		}
		
		for(int i = 1; i <= VirticalLines; i++) System.out.println(lineNumber[i]);
	} main {
		Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\n");
		
		int VirticalLines = scan.nextInt();
		int hoirizontalLines = scan.nextInt();

		int[] lineNumber = new int[VirticalLines + 1];
		for(int i = 1; i <= VirticalLines; i++) lineNumber[i] = i;

		for(int i = 0; i < hoirizontalLines; i++) {
			int a = scan.nextInt();
			int b = scan.nextInt();
			
			int tmp = lineNumber[a];
			lineNumber[a] = lineNumber[b];
			lineNumber[b] = tmp;
		}
		
		for(int i = 1; i <= VirticalLines; i++) System.out.println(lineNumber[i]);
	} Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\n"); scan new Scanner(System.in).useDelimiter("\\s*,\\s*|\\n") new Scanner(System.in).useDelimiter new Scanner(System.in) "\\s*,\\s*|\\n" int VirticalLines = scan.nextInt(); VirticalLines scan.nextInt() scan.nextInt scan int hoirizontalLines = scan.nextInt(); hoirizontalLines scan.nextInt() scan.nextInt scan int[] lineNumber = new int[VirticalLines + 1]; lineNumber new int[VirticalLines + 1] VirticalLines + 1 VirticalLines 1 for(int i = 1; i <= VirticalLines; i++) lineNumber[i] = i; int i = 1; int i = 1; i 1 i <= VirticalLines i VirticalLines i++ i++ i lineNumber[i] = i; lineNumber[i] = i lineNumber[i] lineNumber i i for(int i = 0; i < hoirizontalLines; i++) {
			int a = scan.nextInt();
			int b = scan.nextInt();
			
			int tmp = lineNumber[a];
			lineNumber[a] = lineNumber[b];
			lineNumber[b] = tmp;
		} int i = 0; int i = 0; i 0 i < hoirizontalLines i hoirizontalLines i++ i++ i {
			int a = scan.nextInt();
			int b = scan.nextInt();
			
			int tmp = lineNumber[a];
			lineNumber[a] = lineNumber[b];
			lineNumber[b] = tmp;
		} {
			int a = scan.nextInt();
			int b = scan.nextInt();
			
			int tmp = lineNumber[a];
			lineNumber[a] = lineNumber[b];
			lineNumber[b] = tmp;
		} int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan int b = scan.nextInt(); b scan.nextInt() scan.nextInt scan int tmp = lineNumber[a]; tmp lineNumber[a] lineNumber a lineNumber[a] = lineNumber[b] lineNumber[a] lineNumber a lineNumber[b] lineNumber b lineNumber[b] = tmp lineNumber[b] lineNumber b tmp for(int i = 1; i <= VirticalLines; i++) System.out.println(lineNumber[i]); int i = 1; int i = 1; i 1 i <= VirticalLines i VirticalLines i++ i++ i System.out.println(lineNumber[i]); System.out.println(lineNumber[i]) System.out.println System.out System System.out lineNumber[i] lineNumber i String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\n");
		
		int VirticalLines = scan.nextInt();
		int hoirizontalLines = scan.nextInt();

		int[] lineNumber = new int[VirticalLines + 1];
		for(int i = 1; i <= VirticalLines; i++) lineNumber[i] = i;

		for(int i = 0; i < hoirizontalLines; i++) {
			int a = scan.nextInt();
			int b = scan.nextInt();
			
			int tmp = lineNumber[a];
			lineNumber[a] = lineNumber[b];
			lineNumber[b] = tmp;
		}
		
		for(int i = 1; i <= VirticalLines; i++) System.out.println(lineNumber[i]);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\n");
		
		int VirticalLines = scan.nextInt();
		int hoirizontalLines = scan.nextInt();

		int[] lineNumber = new int[VirticalLines + 1];
		for(int i = 1; i <= VirticalLines; i++) lineNumber[i] = i;

		for(int i = 0; i < hoirizontalLines; i++) {
			int a = scan.nextInt();
			int b = scan.nextInt();
			
			int tmp = lineNumber[a];
			lineNumber[a] = lineNumber[b];
			lineNumber[b] = tmp;
		}
		
		for(int i = 1; i <= VirticalLines; i++) System.out.println(lineNumber[i]);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\n");
		
		int VirticalLines = scan.nextInt();
		int hoirizontalLines = scan.nextInt();

		int[] lineNumber = new int[VirticalLines + 1];
		for(int i = 1; i <= VirticalLines; i++) lineNumber[i] = i;

		for(int i = 0; i < hoirizontalLines; i++) {
			int a = scan.nextInt();
			int b = scan.nextInt();
			
			int tmp = lineNumber[a];
			lineNumber[a] = lineNumber[b];
			lineNumber[b] = tmp;
		}
		
		for(int i = 1; i <= VirticalLines; i++) System.out.println(lineNumber[i]);
	}
}