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 x = 0;
				int[] num = new int[w];
					for(int i=0; i<w; i++)
					{
						num[i] = i+1;
					}
						for(int i=0; i<n; i++)
						{
							String[] str = sc.next().split(",");
							x = num[Integer.valueOf(str[0])-1];
							num[Integer.valueOf(str[0])-1] = num[Integer.valueOf(str[1])-1];
							num[Integer.valueOf(str[1])-1] = x;
						}
							for(int i=0; i<w; i++)
							{
								System.out.println(num[i]);
							}
	}
} 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 x = 0;
				int[] num = new int[w];
					for(int i=0; i<w; i++)
					{
						num[i] = i+1;
					}
						for(int i=0; i<n; i++)
						{
							String[] str = sc.next().split(",");
							x = num[Integer.valueOf(str[0])-1];
							num[Integer.valueOf(str[0])-1] = num[Integer.valueOf(str[1])-1];
							num[Integer.valueOf(str[1])-1] = x;
						}
							for(int i=0; i<w; i++)
							{
								System.out.println(num[i]);
							}
	}
} Main public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
			int w = sc.nextInt();
			int n = sc.nextInt();
			int x = 0;
				int[] num = new int[w];
					for(int i=0; i<w; i++)
					{
						num[i] = i+1;
					}
						for(int i=0; i<n; i++)
						{
							String[] str = sc.next().split(",");
							x = num[Integer.valueOf(str[0])-1];
							num[Integer.valueOf(str[0])-1] = num[Integer.valueOf(str[1])-1];
							num[Integer.valueOf(str[1])-1] = x;
						}
							for(int i=0; i<w; i++)
							{
								System.out.println(num[i]);
							}
	} main {
		Scanner sc = new Scanner(System.in);
			int w = sc.nextInt();
			int n = sc.nextInt();
			int x = 0;
				int[] num = new int[w];
					for(int i=0; i<w; i++)
					{
						num[i] = i+1;
					}
						for(int i=0; i<n; i++)
						{
							String[] str = sc.next().split(",");
							x = num[Integer.valueOf(str[0])-1];
							num[Integer.valueOf(str[0])-1] = num[Integer.valueOf(str[1])-1];
							num[Integer.valueOf(str[1])-1] = x;
						}
							for(int i=0; i<w; i++)
							{
								System.out.println(num[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 x = 0; x 0 int[] num = new int[w]; num new int[w] w for(int i=0; i<w; i++)
					{
						num[i] = i+1;
					} int i=0; int i=0; i 0 i<w i w i++ i++ i {
						num[i] = i+1;
					} {
						num[i] = i+1;
					} num[i] = i+1 num[i] num i i+1 i 1 for(int i=0; i<n; i++)
						{
							String[] str = sc.next().split(",");
							x = num[Integer.valueOf(str[0])-1];
							num[Integer.valueOf(str[0])-1] = num[Integer.valueOf(str[1])-1];
							num[Integer.valueOf(str[1])-1] = x;
						} int i=0; int i=0; i 0 i<n i n i++ i++ i {
							String[] str = sc.next().split(",");
							x = num[Integer.valueOf(str[0])-1];
							num[Integer.valueOf(str[0])-1] = num[Integer.valueOf(str[1])-1];
							num[Integer.valueOf(str[1])-1] = x;
						} {
							String[] str = sc.next().split(",");
							x = num[Integer.valueOf(str[0])-1];
							num[Integer.valueOf(str[0])-1] = num[Integer.valueOf(str[1])-1];
							num[Integer.valueOf(str[1])-1] = x;
						} String[] str = sc.next().split(","); str sc.next().split(",") sc.next().split sc.next() sc.next sc "," x = num[Integer.valueOf(str[0])-1] x num[Integer.valueOf(str[0])-1] num Integer.valueOf(str[0])-1 Integer.valueOf(str[0]) Integer.valueOf Integer str[0] str 0 1 num[Integer.valueOf(str[0])-1] = num[Integer.valueOf(str[1])-1] num[Integer.valueOf(str[0])-1] num Integer.valueOf(str[0])-1 Integer.valueOf(str[0]) Integer.valueOf Integer str[0] str 0 1 num[Integer.valueOf(str[1])-1] num Integer.valueOf(str[1])-1 Integer.valueOf(str[1]) Integer.valueOf Integer str[1] str 1 1 num[Integer.valueOf(str[1])-1] = x num[Integer.valueOf(str[1])-1] num Integer.valueOf(str[1])-1 Integer.valueOf(str[1]) Integer.valueOf Integer str[1] str 1 1 x for(int i=0; i<w; i++)
							{
								System.out.println(num[i]);
							} int i=0; int i=0; i 0 i<w i w i++ i++ i {
								System.out.println(num[i]);
							} {
								System.out.println(num[i]);
							} System.out.println(num[i]) System.out.println System.out System System.out num[i] num i String[] args args public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
			int w = sc.nextInt();
			int n = sc.nextInt();
			int x = 0;
				int[] num = new int[w];
					for(int i=0; i<w; i++)
					{
						num[i] = i+1;
					}
						for(int i=0; i<n; i++)
						{
							String[] str = sc.next().split(",");
							x = num[Integer.valueOf(str[0])-1];
							num[Integer.valueOf(str[0])-1] = num[Integer.valueOf(str[1])-1];
							num[Integer.valueOf(str[1])-1] = x;
						}
							for(int i=0; i<w; i++)
							{
								System.out.println(num[i]);
							}
	}
} public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
			int w = sc.nextInt();
			int n = sc.nextInt();
			int x = 0;
				int[] num = new int[w];
					for(int i=0; i<w; i++)
					{
						num[i] = i+1;
					}
						for(int i=0; i<n; i++)
						{
							String[] str = sc.next().split(",");
							x = num[Integer.valueOf(str[0])-1];
							num[Integer.valueOf(str[0])-1] = num[Integer.valueOf(str[1])-1];
							num[Integer.valueOf(str[1])-1] = x;
						}
							for(int i=0; i<w; i++)
							{
								System.out.println(num[i]);
							}
	}
} 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 x = 0;
				int[] num = new int[w];
					for(int i=0; i<w; i++)
					{
						num[i] = i+1;
					}
						for(int i=0; i<n; i++)
						{
							String[] str = sc.next().split(",");
							x = num[Integer.valueOf(str[0])-1];
							num[Integer.valueOf(str[0])-1] = num[Integer.valueOf(str[1])-1];
							num[Integer.valueOf(str[1])-1] = x;
						}
							for(int i=0; i<w; i++)
							{
								System.out.println(num[i]);
							}
	}
}