import java.util.Scanner;

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

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