import java.util.Scanner;

public class Main{
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] s = new int[w + 1];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		s[w] = 0;
		for (int j = 0; j < n; j++) {
			String str = scan.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]);
			int b = Integer.parseInt(ab[1]);
			s[w] = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = s[w];
		}
		for (int k = 0; k < w; k++) {
			System.out.println(s[k]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] s = new int[w + 1];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		s[w] = 0;
		for (int j = 0; j < n; j++) {
			String str = scan.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]);
			int b = Integer.parseInt(ab[1]);
			s[w] = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = s[w];
		}
		for (int k = 0; k < w; k++) {
			System.out.println(s[k]);
		}
	}
} Main public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] s = new int[w + 1];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		s[w] = 0;
		for (int j = 0; j < n; j++) {
			String str = scan.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]);
			int b = Integer.parseInt(ab[1]);
			s[w] = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = s[w];
		}
		for (int k = 0; k < w; k++) {
			System.out.println(s[k]);
		}
	} main {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] s = new int[w + 1];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		s[w] = 0;
		for (int j = 0; j < n; j++) {
			String str = scan.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]);
			int b = Integer.parseInt(ab[1]);
			s[w] = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = s[w];
		}
		for (int k = 0; k < w; k++) {
			System.out.println(s[k]);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] s = new int[w + 1]; s new int[w + 1] w + 1 w 1 for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			s[i] = i + 1;
		} {
			s[i] = i + 1;
		} s[i] = i + 1 s[i] s i i + 1 i 1 s[w] = 0 s[w] s w 0 for (int j = 0; j < n; j++) {
			String str = scan.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]);
			int b = Integer.parseInt(ab[1]);
			s[w] = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = s[w];
		} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
			String str = scan.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]);
			int b = Integer.parseInt(ab[1]);
			s[w] = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = s[w];
		} {
			String str = scan.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]);
			int b = Integer.parseInt(ab[1]);
			s[w] = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = s[w];
		} String str = scan.next(); str scan.next() scan.next scan String[] ab = str.split(","); ab str.split(",") str.split str "," int a = Integer.parseInt(ab[0]); a Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 int b = Integer.parseInt(ab[1]); b Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 s[w] = s[a - 1] s[w] s w s[a - 1] s a - 1 a 1 s[a - 1] = s[b - 1] s[a - 1] s a - 1 a 1 s[b - 1] s b - 1 b 1 s[b - 1] = s[w] s[b - 1] s b - 1 b 1 s[w] s w for (int k = 0; k < w; k++) {
			System.out.println(s[k]);
		} int k = 0; int k = 0; k 0 k < w k w k++ k++ k {
			System.out.println(s[k]);
		} {
			System.out.println(s[k]);
		} System.out.println(s[k]) System.out.println System.out System System.out s[k] s k String args[] args public class Main{
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] s = new int[w + 1];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		s[w] = 0;
		for (int j = 0; j < n; j++) {
			String str = scan.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]);
			int b = Integer.parseInt(ab[1]);
			s[w] = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = s[w];
		}
		for (int k = 0; k < w; k++) {
			System.out.println(s[k]);
		}
	}
} public class Main{
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] s = new int[w + 1];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		s[w] = 0;
		for (int j = 0; j < n; j++) {
			String str = scan.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]);
			int b = Integer.parseInt(ab[1]);
			s[w] = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = s[w];
		}
		for (int k = 0; k < w; k++) {
			System.out.println(s[k]);
		}
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] s = new int[w + 1];
		for (int i = 0; i < w; i++) {
			s[i] = i + 1;
		}
		s[w] = 0;
		for (int j = 0; j < n; j++) {
			String str = scan.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]);
			int b = Integer.parseInt(ab[1]);
			s[w] = s[a - 1];
			s[a - 1] = s[b - 1];
			s[b - 1] = s[w];
		}
		for (int k = 0; k < w; k++) {
			System.out.println(s[k]);
		}
	}
}