import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int h = sc.nextInt();

		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
		{
			ary[i] = i + 1;
		}

		for (int i = 0; i < h; i++)
		{
			String ab = sc.next();
			int a = Integer.parseInt(ab.split(",")[0]) - 1;
			int b = Integer.parseInt(ab.split(",")[1]) - 1;

			int temp = ary[a];
			ary[a] = ary[b];
			ary[b] = temp;
		}

		for (int a :
				ary)
		{
			System.out.println(a);
		}
	}
}
 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 h = sc.nextInt();

		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
		{
			ary[i] = i + 1;
		}

		for (int i = 0; i < h; i++)
		{
			String ab = sc.next();
			int a = Integer.parseInt(ab.split(",")[0]) - 1;
			int b = Integer.parseInt(ab.split(",")[1]) - 1;

			int temp = ary[a];
			ary[a] = ary[b];
			ary[b] = temp;
		}

		for (int a :
				ary)
		{
			System.out.println(a);
		}
	}
} Main public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int h = sc.nextInt();

		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
		{
			ary[i] = i + 1;
		}

		for (int i = 0; i < h; i++)
		{
			String ab = sc.next();
			int a = Integer.parseInt(ab.split(",")[0]) - 1;
			int b = Integer.parseInt(ab.split(",")[1]) - 1;

			int temp = ary[a];
			ary[a] = ary[b];
			ary[b] = temp;
		}

		for (int a :
				ary)
		{
			System.out.println(a);
		}
	} main {
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int h = sc.nextInt();

		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
		{
			ary[i] = i + 1;
		}

		for (int i = 0; i < h; i++)
		{
			String ab = sc.next();
			int a = Integer.parseInt(ab.split(",")[0]) - 1;
			int b = Integer.parseInt(ab.split(",")[1]) - 1;

			int temp = ary[a];
			ary[a] = ary[b];
			ary[b] = temp;
		}

		for (int a :
				ary)
		{
			System.out.println(a);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int h = sc.nextInt(); h sc.nextInt() sc.nextInt sc int[] ary = new int[w]; ary new int[w] w for (int i = 0; i < w; i++)
		{
			ary[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			ary[i] = i + 1;
		} {
			ary[i] = i + 1;
		} ary[i] = i + 1 ary[i] ary i i + 1 i 1 for (int i = 0; i < h; i++)
		{
			String ab = sc.next();
			int a = Integer.parseInt(ab.split(",")[0]) - 1;
			int b = Integer.parseInt(ab.split(",")[1]) - 1;

			int temp = ary[a];
			ary[a] = ary[b];
			ary[b] = temp;
		} int i = 0; int i = 0; i 0 i < h i h i++ i++ i {
			String ab = sc.next();
			int a = Integer.parseInt(ab.split(",")[0]) - 1;
			int b = Integer.parseInt(ab.split(",")[1]) - 1;

			int temp = ary[a];
			ary[a] = ary[b];
			ary[b] = temp;
		} {
			String ab = sc.next();
			int a = Integer.parseInt(ab.split(",")[0]) - 1;
			int b = Integer.parseInt(ab.split(",")[1]) - 1;

			int temp = ary[a];
			ary[a] = ary[b];
			ary[b] = temp;
		} String ab = sc.next(); ab sc.next() sc.next sc int a = Integer.parseInt(ab.split(",")[0]) - 1; a Integer.parseInt(ab.split(",")[0]) - 1 Integer.parseInt(ab.split(",")[0]) Integer.parseInt Integer ab.split(",")[0] ab.split(",") ab.split ab "," 0 1 int b = Integer.parseInt(ab.split(",")[1]) - 1; b Integer.parseInt(ab.split(",")[1]) - 1 Integer.parseInt(ab.split(",")[1]) Integer.parseInt Integer ab.split(",")[1] ab.split(",") ab.split ab "," 1 1 int temp = ary[a]; temp ary[a] ary a ary[a] = ary[b] ary[a] ary a ary[b] ary b ary[b] = temp ary[b] ary b temp for (int a :
				ary)
		{
			System.out.println(a);
		} int a ary {
			System.out.println(a);
		} {
			System.out.println(a);
		} System.out.println(a) System.out.println System.out System System.out a String[] args args public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int h = sc.nextInt();

		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
		{
			ary[i] = i + 1;
		}

		for (int i = 0; i < h; i++)
		{
			String ab = sc.next();
			int a = Integer.parseInt(ab.split(",")[0]) - 1;
			int b = Integer.parseInt(ab.split(",")[1]) - 1;

			int temp = ary[a];
			ary[a] = ary[b];
			ary[b] = temp;
		}

		for (int a :
				ary)
		{
			System.out.println(a);
		}
	}
} public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int h = sc.nextInt();

		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
		{
			ary[i] = i + 1;
		}

		for (int i = 0; i < h; i++)
		{
			String ab = sc.next();
			int a = Integer.parseInt(ab.split(",")[0]) - 1;
			int b = Integer.parseInt(ab.split(",")[1]) - 1;

			int temp = ary[a];
			ary[a] = ary[b];
			ary[b] = temp;
		}

		for (int a :
				ary)
		{
			System.out.println(a);
		}
	}
} 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 h = sc.nextInt();

		int[] ary = new int[w];
		for (int i = 0; i < w; i++)
		{
			ary[i] = i + 1;
		}

		for (int i = 0; i < h; i++)
		{
			String ab = sc.next();
			int a = Integer.parseInt(ab.split(",")[0]) - 1;
			int b = Integer.parseInt(ab.split(",")[1]) - 1;

			int temp = ary[a];
			ary[a] = ary[b];
			ary[b] = temp;
		}

		for (int a :
				ary)
		{
			System.out.println(a);
		}
	}
}

