import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in).useDelimiter("[,\\n]");
		
		int w = sc.nextInt();
		int lines[] = new int[w];
		for (int i = 0; i < w; i++)
		{
			lines[i] = i;
		}
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
		{
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int tmp = lines[a];
			lines[a] = lines[b];
			lines[b] = tmp;
		}
		for (int i = 0; i < w; i++)
		{
			System.out.println(Integer.toString(lines[i] + 1));
		}
	}
} import java.util.Scanner; Scanner java.util class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in).useDelimiter("[,\\n]");
		
		int w = sc.nextInt();
		int lines[] = new int[w];
		for (int i = 0; i < w; i++)
		{
			lines[i] = i;
		}
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
		{
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int tmp = lines[a];
			lines[a] = lines[b];
			lines[b] = tmp;
		}
		for (int i = 0; i < w; i++)
		{
			System.out.println(Integer.toString(lines[i] + 1));
		}
	}
} Main public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in).useDelimiter("[,\\n]");
		
		int w = sc.nextInt();
		int lines[] = new int[w];
		for (int i = 0; i < w; i++)
		{
			lines[i] = i;
		}
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
		{
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int tmp = lines[a];
			lines[a] = lines[b];
			lines[b] = tmp;
		}
		for (int i = 0; i < w; i++)
		{
			System.out.println(Integer.toString(lines[i] + 1));
		}
	} main {
		Scanner sc = new Scanner(System.in).useDelimiter("[,\\n]");
		
		int w = sc.nextInt();
		int lines[] = new int[w];
		for (int i = 0; i < w; i++)
		{
			lines[i] = i;
		}
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
		{
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int tmp = lines[a];
			lines[a] = lines[b];
			lines[b] = tmp;
		}
		for (int i = 0; i < w; i++)
		{
			System.out.println(Integer.toString(lines[i] + 1));
		}
	} Scanner sc = new Scanner(System.in).useDelimiter("[,\\n]"); sc new Scanner(System.in).useDelimiter("[,\\n]") new Scanner(System.in).useDelimiter new Scanner(System.in) "[,\\n]" int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int lines[] = new int[w]; lines new int[w] w for (int i = 0; i < w; i++)
		{
			lines[i] = i;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			lines[i] = i;
		} {
			lines[i] = i;
		} lines[i] = i lines[i] lines i i int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for (int i = 0; i < n; i++)
		{
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int tmp = lines[a];
			lines[a] = lines[b];
			lines[b] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int tmp = lines[a];
			lines[a] = lines[b];
			lines[b] = tmp;
		} {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int tmp = lines[a];
			lines[a] = lines[b];
			lines[b] = tmp;
		} int a = sc.nextInt() - 1; a sc.nextInt() - 1 sc.nextInt() sc.nextInt sc 1 int b = sc.nextInt() - 1; b sc.nextInt() - 1 sc.nextInt() sc.nextInt sc 1 int tmp = lines[a]; tmp lines[a] lines a lines[a] = lines[b] lines[a] lines a lines[b] lines b lines[b] = tmp lines[b] lines b tmp for (int i = 0; i < w; i++)
		{
			System.out.println(Integer.toString(lines[i] + 1));
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(Integer.toString(lines[i] + 1));
		} {
			System.out.println(Integer.toString(lines[i] + 1));
		} System.out.println(Integer.toString(lines[i] + 1)) System.out.println System.out System System.out Integer.toString(lines[i] + 1) Integer.toString Integer lines[i] + 1 lines[i] lines i 1 String args[] args
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in).useDelimiter("[,\\n]");
		
		int w = sc.nextInt();
		int lines[] = new int[w];
		for (int i = 0; i < w; i++)
		{
			lines[i] = i;
		}
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
		{
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int tmp = lines[a];
			lines[a] = lines[b];
			lines[b] = tmp;
		}
		for (int i = 0; i < w; i++)
		{
			System.out.println(Integer.toString(lines[i] + 1));
		}
	}
}