import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int m = Integer.parseInt(br.readLine());
		int[] p = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			p[i] = i;
		}
		while (m-- > 0) {
			String s = br.readLine();
			int a = Integer.parseInt(s.split(",")[0]);
			int b = Integer.parseInt(s.split(",")[1]);
			int t = p[a];
			p[a] = p[b];
			p[b] = t;
		}
		for (int i = 1; i <= n; i++) {
			System.out.println(p[i]);
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int m = Integer.parseInt(br.readLine());
		int[] p = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			p[i] = i;
		}
		while (m-- > 0) {
			String s = br.readLine();
			int a = Integer.parseInt(s.split(",")[0]);
			int b = Integer.parseInt(s.split(",")[1]);
			int t = p[a];
			p[a] = p[b];
			p[b] = t;
		}
		for (int i = 1; i <= n; i++) {
			System.out.println(p[i]);
		}
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int m = Integer.parseInt(br.readLine());
		int[] p = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			p[i] = i;
		}
		while (m-- > 0) {
			String s = br.readLine();
			int a = Integer.parseInt(s.split(",")[0]);
			int b = Integer.parseInt(s.split(",")[1]);
			int t = p[a];
			p[a] = p[b];
			p[b] = t;
		}
		for (int i = 1; i <= n; i++) {
			System.out.println(p[i]);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int m = Integer.parseInt(br.readLine());
		int[] p = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			p[i] = i;
		}
		while (m-- > 0) {
			String s = br.readLine();
			int a = Integer.parseInt(s.split(",")[0]);
			int b = Integer.parseInt(s.split(",")[1]);
			int t = p[a];
			p[a] = p[b];
			p[b] = t;
		}
		for (int i = 1; i <= n; i++) {
			System.out.println(p[i]);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int m = Integer.parseInt(br.readLine()); m Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] p = new int[n + 1]; p new int[n + 1] n + 1 n 1 for (int i = 1; i <= n; i++) {
			p[i] = i;
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			p[i] = i;
		} {
			p[i] = i;
		} p[i] = i p[i] p i i while (m-- > 0) {
			String s = br.readLine();
			int a = Integer.parseInt(s.split(",")[0]);
			int b = Integer.parseInt(s.split(",")[1]);
			int t = p[a];
			p[a] = p[b];
			p[b] = t;
		} m-- > 0 m-- m 0 {
			String s = br.readLine();
			int a = Integer.parseInt(s.split(",")[0]);
			int b = Integer.parseInt(s.split(",")[1]);
			int t = p[a];
			p[a] = p[b];
			p[b] = t;
		} String s = br.readLine(); s br.readLine() br.readLine br int a = Integer.parseInt(s.split(",")[0]); a Integer.parseInt(s.split(",")[0]) Integer.parseInt Integer s.split(",")[0] s.split(",") s.split s "," 0 int b = Integer.parseInt(s.split(",")[1]); b Integer.parseInt(s.split(",")[1]) Integer.parseInt Integer s.split(",")[1] s.split(",") s.split s "," 1 int t = p[a]; t p[a] p a p[a] = p[b] p[a] p a p[b] p b p[b] = t p[b] p b t for (int i = 1; i <= n; i++) {
			System.out.println(p[i]);
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			System.out.println(p[i]);
		} {
			System.out.println(p[i]);
		} System.out.println(p[i]) System.out.println System.out System System.out p[i] p i String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int m = Integer.parseInt(br.readLine());
		int[] p = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			p[i] = i;
		}
		while (m-- > 0) {
			String s = br.readLine();
			int a = Integer.parseInt(s.split(",")[0]);
			int b = Integer.parseInt(s.split(",")[1]);
			int t = p[a];
			p[a] = p[b];
			p[b] = t;
		}
		for (int i = 1; i <= n; i++) {
			System.out.println(p[i]);
		}
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int m = Integer.parseInt(br.readLine());
		int[] p = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			p[i] = i;
		}
		while (m-- > 0) {
			String s = br.readLine();
			int a = Integer.parseInt(s.split(",")[0]);
			int b = Integer.parseInt(s.split(",")[1]);
			int t = p[a];
			p[a] = p[b];
			p[b] = t;
		}
		for (int i = 1; i <= n; i++) {
			System.out.println(p[i]);
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int m = Integer.parseInt(br.readLine());
		int[] p = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			p[i] = i;
		}
		while (m-- > 0) {
			String s = br.readLine();
			int a = Integer.parseInt(s.split(",")[0]);
			int b = Integer.parseInt(s.split(",")[1]);
			int t = p[a];
			p[a] = p[b];
			p[b] = t;
		}
		for (int i = 1; i <= n; i++) {
			System.out.println(p[i]);
		}
	}
}