import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		try
		{
			Scanner sc = new Scanner(System.in);
			int w, n, a, b, tmp;
			String input;

			w = sc.nextInt();
			n = sc.nextInt();

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

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

				tmp = lots[a];
				lots[a] = lots[b];
				lots[b] = tmp;
			}

			for(int i = 0; i < w; i++)
			{
				System.out.println(lots[i]);
			}
		}
		catch(InputMismatchException e)
		{
			System.out.println(e);
		}
	}
} import java.util.*; util.* java public class Main
{
	public static void main(String[] args)
	{
		try
		{
			Scanner sc = new Scanner(System.in);
			int w, n, a, b, tmp;
			String input;

			w = sc.nextInt();
			n = sc.nextInt();

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

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

				tmp = lots[a];
				lots[a] = lots[b];
				lots[b] = tmp;
			}

			for(int i = 0; i < w; i++)
			{
				System.out.println(lots[i]);
			}
		}
		catch(InputMismatchException e)
		{
			System.out.println(e);
		}
	}
} Main public static void main(String[] args)
	{
		try
		{
			Scanner sc = new Scanner(System.in);
			int w, n, a, b, tmp;
			String input;

			w = sc.nextInt();
			n = sc.nextInt();

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

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

				tmp = lots[a];
				lots[a] = lots[b];
				lots[b] = tmp;
			}

			for(int i = 0; i < w; i++)
			{
				System.out.println(lots[i]);
			}
		}
		catch(InputMismatchException e)
		{
			System.out.println(e);
		}
	} main {
		try
		{
			Scanner sc = new Scanner(System.in);
			int w, n, a, b, tmp;
			String input;

			w = sc.nextInt();
			n = sc.nextInt();

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

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

				tmp = lots[a];
				lots[a] = lots[b];
				lots[b] = tmp;
			}

			for(int i = 0; i < w; i++)
			{
				System.out.println(lots[i]);
			}
		}
		catch(InputMismatchException e)
		{
			System.out.println(e);
		}
	} try
		{
			Scanner sc = new Scanner(System.in);
			int w, n, a, b, tmp;
			String input;

			w = sc.nextInt();
			n = sc.nextInt();

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

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

				tmp = lots[a];
				lots[a] = lots[b];
				lots[b] = tmp;
			}

			for(int i = 0; i < w; i++)
			{
				System.out.println(lots[i]);
			}
		}
		catch(InputMismatchException e)
		{
			System.out.println(e);
		} catch(InputMismatchException e)
		{
			System.out.println(e);
		} InputMismatchException e {
			System.out.println(e);
		} System.out.println(e) System.out.println System.out System System.out e {
			Scanner sc = new Scanner(System.in);
			int w, n, a, b, tmp;
			String input;

			w = sc.nextInt();
			n = sc.nextInt();

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

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

				tmp = lots[a];
				lots[a] = lots[b];
				lots[b] = tmp;
			}

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

				tmp = lots[a];
				lots[a] = lots[b];
				lots[b] = tmp;
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				input = sc.next();
				String[] ab = input.split(",");
				a = Integer.parseInt(ab[0]) - 1;
				b = Integer.parseInt(ab[1]) - 1;

				tmp = lots[a];
				lots[a] = lots[b];
				lots[b] = tmp;
			} {
				input = sc.next();
				String[] ab = input.split(",");
				a = Integer.parseInt(ab[0]) - 1;
				b = Integer.parseInt(ab[1]) - 1;

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

			w = sc.nextInt();
			n = sc.nextInt();

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

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

				tmp = lots[a];
				lots[a] = lots[b];
				lots[b] = tmp;
			}

			for(int i = 0; i < w; i++)
			{
				System.out.println(lots[i]);
			}
		}
		catch(InputMismatchException e)
		{
			System.out.println(e);
		}
	}
} public class Main
{
	public static void main(String[] args)
	{
		try
		{
			Scanner sc = new Scanner(System.in);
			int w, n, a, b, tmp;
			String input;

			w = sc.nextInt();
			n = sc.nextInt();

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

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

				tmp = lots[a];
				lots[a] = lots[b];
				lots[b] = tmp;
			}

			for(int i = 0; i < w; i++)
			{
				System.out.println(lots[i]);
			}
		}
		catch(InputMismatchException e)
		{
			System.out.println(e);
		}
	}
} Main
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		try
		{
			Scanner sc = new Scanner(System.in);
			int w, n, a, b, tmp;
			String input;

			w = sc.nextInt();
			n = sc.nextInt();

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

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

				tmp = lots[a];
				lots[a] = lots[b];
				lots[b] = tmp;
			}

			for(int i = 0; i < w; i++)
			{
				System.out.println(lots[i]);
			}
		}
		catch(InputMismatchException e)
		{
			System.out.println(e);
		}
	}
}