import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int w = Integer.parseInt(sc.nextLine());
			int n = Integer.parseInt(sc.nextLine());
			int[] ans = new int[w];
			for (int i = 0; i < ans.length; i++) {
				ans[i] = i + 1;
			}
			while (sc.hasNext()) {	
				String[] s = sc.nextLine().split(",");
				int x = Integer.parseInt(s[0]) - 1;
				int y = Integer.parseInt(s[1]) - 1;
				int tmp = ans[x];
				ans[x] = ans[y];
				ans[y] = tmp;
				
			}
			for (int z : ans) {
				System.out.println(z);
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int w = Integer.parseInt(sc.nextLine());
			int n = Integer.parseInt(sc.nextLine());
			int[] ans = new int[w];
			for (int i = 0; i < ans.length; i++) {
				ans[i] = i + 1;
			}
			while (sc.hasNext()) {	
				String[] s = sc.nextLine().split(",");
				int x = Integer.parseInt(s[0]) - 1;
				int y = Integer.parseInt(s[1]) - 1;
				int tmp = ans[x];
				ans[x] = ans[y];
				ans[y] = tmp;
				
			}
			for (int z : ans) {
				System.out.println(z);
			}
		}
	}
} Main public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int w = Integer.parseInt(sc.nextLine());
			int n = Integer.parseInt(sc.nextLine());
			int[] ans = new int[w];
			for (int i = 0; i < ans.length; i++) {
				ans[i] = i + 1;
			}
			while (sc.hasNext()) {	
				String[] s = sc.nextLine().split(",");
				int x = Integer.parseInt(s[0]) - 1;
				int y = Integer.parseInt(s[1]) - 1;
				int tmp = ans[x];
				ans[x] = ans[y];
				ans[y] = tmp;
				
			}
			for (int z : ans) {
				System.out.println(z);
			}
		}
	} main {
		try (Scanner sc = new Scanner(System.in)) {
			int w = Integer.parseInt(sc.nextLine());
			int n = Integer.parseInt(sc.nextLine());
			int[] ans = new int[w];
			for (int i = 0; i < ans.length; i++) {
				ans[i] = i + 1;
			}
			while (sc.hasNext()) {	
				String[] s = sc.nextLine().split(",");
				int x = Integer.parseInt(s[0]) - 1;
				int y = Integer.parseInt(s[1]) - 1;
				int tmp = ans[x];
				ans[x] = ans[y];
				ans[y] = tmp;
				
			}
			for (int z : ans) {
				System.out.println(z);
			}
		}
	} try (Scanner sc = new Scanner(System.in)) {
			int w = Integer.parseInt(sc.nextLine());
			int n = Integer.parseInt(sc.nextLine());
			int[] ans = new int[w];
			for (int i = 0; i < ans.length; i++) {
				ans[i] = i + 1;
			}
			while (sc.hasNext()) {	
				String[] s = sc.nextLine().split(",");
				int x = Integer.parseInt(s[0]) - 1;
				int y = Integer.parseInt(s[1]) - 1;
				int tmp = ans[x];
				ans[x] = ans[y];
				ans[y] = tmp;
				
			}
			for (int z : ans) {
				System.out.println(z);
			}
		} {
			int w = Integer.parseInt(sc.nextLine());
			int n = Integer.parseInt(sc.nextLine());
			int[] ans = new int[w];
			for (int i = 0; i < ans.length; i++) {
				ans[i] = i + 1;
			}
			while (sc.hasNext()) {	
				String[] s = sc.nextLine().split(",");
				int x = Integer.parseInt(s[0]) - 1;
				int y = Integer.parseInt(s[1]) - 1;
				int tmp = ans[x];
				ans[x] = ans[y];
				ans[y] = tmp;
				
			}
			for (int z : ans) {
				System.out.println(z);
			}
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int w = Integer.parseInt(sc.nextLine()); w Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int[] ans = new int[w]; ans new int[w] w for (int i = 0; i < ans.length; i++) {
				ans[i] = i + 1;
			} int i = 0; int i = 0; i 0 i < ans.length i ans.length ans ans.length i++ i++ i {
				ans[i] = i + 1;
			} {
				ans[i] = i + 1;
			} ans[i] = i + 1 ans[i] ans i i + 1 i 1 while (sc.hasNext()) {	
				String[] s = sc.nextLine().split(",");
				int x = Integer.parseInt(s[0]) - 1;
				int y = Integer.parseInt(s[1]) - 1;
				int tmp = ans[x];
				ans[x] = ans[y];
				ans[y] = tmp;
				
			} sc.hasNext() sc.hasNext sc {	
				String[] s = sc.nextLine().split(",");
				int x = Integer.parseInt(s[0]) - 1;
				int y = Integer.parseInt(s[1]) - 1;
				int tmp = ans[x];
				ans[x] = ans[y];
				ans[y] = tmp;
				
			} String[] s = sc.nextLine().split(","); s sc.nextLine().split(",") sc.nextLine().split sc.nextLine() sc.nextLine sc "," int x = Integer.parseInt(s[0]) - 1; x Integer.parseInt(s[0]) - 1 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 1 int y = Integer.parseInt(s[1]) - 1; y Integer.parseInt(s[1]) - 1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 1 int tmp = ans[x]; tmp ans[x] ans x ans[x] = ans[y] ans[x] ans x ans[y] ans y ans[y] = tmp ans[y] ans y tmp for (int z : ans) {
				System.out.println(z);
			} int z ans {
				System.out.println(z);
			} {
				System.out.println(z);
			} System.out.println(z) System.out.println System.out System System.out z String[] args args public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int w = Integer.parseInt(sc.nextLine());
			int n = Integer.parseInt(sc.nextLine());
			int[] ans = new int[w];
			for (int i = 0; i < ans.length; i++) {
				ans[i] = i + 1;
			}
			while (sc.hasNext()) {	
				String[] s = sc.nextLine().split(",");
				int x = Integer.parseInt(s[0]) - 1;
				int y = Integer.parseInt(s[1]) - 1;
				int tmp = ans[x];
				ans[x] = ans[y];
				ans[y] = tmp;
				
			}
			for (int z : ans) {
				System.out.println(z);
			}
		}
	}
} public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int w = Integer.parseInt(sc.nextLine());
			int n = Integer.parseInt(sc.nextLine());
			int[] ans = new int[w];
			for (int i = 0; i < ans.length; i++) {
				ans[i] = i + 1;
			}
			while (sc.hasNext()) {	
				String[] s = sc.nextLine().split(",");
				int x = Integer.parseInt(s[0]) - 1;
				int y = Integer.parseInt(s[1]) - 1;
				int tmp = ans[x];
				ans[x] = ans[y];
				ans[y] = tmp;
				
			}
			for (int z : ans) {
				System.out.println(z);
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int w = Integer.parseInt(sc.nextLine());
			int n = Integer.parseInt(sc.nextLine());
			int[] ans = new int[w];
			for (int i = 0; i < ans.length; i++) {
				ans[i] = i + 1;
			}
			while (sc.hasNext()) {	
				String[] s = sc.nextLine().split(",");
				int x = Integer.parseInt(s[0]) - 1;
				int y = Integer.parseInt(s[1]) - 1;
				int tmp = ans[x];
				ans[x] = ans[y];
				ans[y] = tmp;
				
			}
			for (int z : ans) {
				System.out.println(z);
			}
		}
	}
}