import java.util.Scanner;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String arg[])
	{
		Scanner scan = new Scanner(System.in);
		
	
		int w = scan.nextInt();
		int n = scan.nextInt();
		int ans[]= new int[w+1];
		for(int i = 1; i <= w; i++)
		{
			ans [i]= i;
		}

		for(int i=0; i < n; i++)
		{
			
			String str = scan.next();
			StringTokenizer st = new StringTokenizer(str, ",");
			swap(ans, st.nextToken(),st.nextToken());
		}

		for(int i = 1; i <= w; i++)
		{
			System.out.println(ans[i]);
		}

	}

	public static void swap(int a[], String b, String c)
	{
	    int  tmp = a[Integer.valueOf(b)];
		a[Integer.valueOf(b)] = a[Integer.valueOf(c)];
		a[Integer.valueOf(c)] = tmp;
	}

} import java.util.Scanner; Scanner java.util import java.util.StringTokenizer; StringTokenizer java.util public class Main
{
	public static void main(String arg[])
	{
		Scanner scan = new Scanner(System.in);
		
	
		int w = scan.nextInt();
		int n = scan.nextInt();
		int ans[]= new int[w+1];
		for(int i = 1; i <= w; i++)
		{
			ans [i]= i;
		}

		for(int i=0; i < n; i++)
		{
			
			String str = scan.next();
			StringTokenizer st = new StringTokenizer(str, ",");
			swap(ans, st.nextToken(),st.nextToken());
		}

		for(int i = 1; i <= w; i++)
		{
			System.out.println(ans[i]);
		}

	}

	public static void swap(int a[], String b, String c)
	{
	    int  tmp = a[Integer.valueOf(b)];
		a[Integer.valueOf(b)] = a[Integer.valueOf(c)];
		a[Integer.valueOf(c)] = tmp;
	}

} Main public static void main(String arg[])
	{
		Scanner scan = new Scanner(System.in);
		
	
		int w = scan.nextInt();
		int n = scan.nextInt();
		int ans[]= new int[w+1];
		for(int i = 1; i <= w; i++)
		{
			ans [i]= i;
		}

		for(int i=0; i < n; i++)
		{
			
			String str = scan.next();
			StringTokenizer st = new StringTokenizer(str, ",");
			swap(ans, st.nextToken(),st.nextToken());
		}

		for(int i = 1; i <= w; i++)
		{
			System.out.println(ans[i]);
		}

	} main {
		Scanner scan = new Scanner(System.in);
		
	
		int w = scan.nextInt();
		int n = scan.nextInt();
		int ans[]= new int[w+1];
		for(int i = 1; i <= w; i++)
		{
			ans [i]= i;
		}

		for(int i=0; i < n; i++)
		{
			
			String str = scan.next();
			StringTokenizer st = new StringTokenizer(str, ",");
			swap(ans, st.nextToken(),st.nextToken());
		}

		for(int i = 1; i <= w; i++)
		{
			System.out.println(ans[i]);
		}

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int ans[]= new int[w+1]; ans new int[w+1] w+1 w 1 for(int i = 1; i <= w; i++)
		{
			ans [i]= i;
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			ans [i]= i;
		} {
			ans [i]= i;
		} ans [i]= i ans [i] ans i i for(int i=0; i < n; i++)
		{
			
			String str = scan.next();
			StringTokenizer st = new StringTokenizer(str, ",");
			swap(ans, st.nextToken(),st.nextToken());
		} int i=0; int i=0; i 0 i < n i n i++ i++ i {
			
			String str = scan.next();
			StringTokenizer st = new StringTokenizer(str, ",");
			swap(ans, st.nextToken(),st.nextToken());
		} {
			
			String str = scan.next();
			StringTokenizer st = new StringTokenizer(str, ",");
			swap(ans, st.nextToken(),st.nextToken());
		} String str = scan.next(); str scan.next() scan.next scan StringTokenizer st = new StringTokenizer(str, ","); st new StringTokenizer(str, ",") swap(ans, st.nextToken(),st.nextToken()) swap ans st.nextToken() st.nextToken st st.nextToken() st.nextToken st for(int i = 1; i <= w; i++)
		{
			System.out.println(ans[i]);
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			System.out.println(ans[i]);
		} {
			System.out.println(ans[i]);
		} System.out.println(ans[i]) System.out.println System.out System System.out ans[i] ans i String arg[] arg public static void swap(int a[], String b, String c)
	{
	    int  tmp = a[Integer.valueOf(b)];
		a[Integer.valueOf(b)] = a[Integer.valueOf(c)];
		a[Integer.valueOf(c)] = tmp;
	} swap {
	    int  tmp = a[Integer.valueOf(b)];
		a[Integer.valueOf(b)] = a[Integer.valueOf(c)];
		a[Integer.valueOf(c)] = tmp;
	} int  tmp = a[Integer.valueOf(b)]; tmp a[Integer.valueOf(b)] a Integer.valueOf(b) Integer.valueOf Integer b a[Integer.valueOf(b)] = a[Integer.valueOf(c)] a[Integer.valueOf(b)] a Integer.valueOf(b) Integer.valueOf Integer b a[Integer.valueOf(c)] a Integer.valueOf(c) Integer.valueOf Integer c a[Integer.valueOf(c)] = tmp a[Integer.valueOf(c)] a Integer.valueOf(c) Integer.valueOf Integer c tmp int a[] a String b b String c c public class Main
{
	public static void main(String arg[])
	{
		Scanner scan = new Scanner(System.in);
		
	
		int w = scan.nextInt();
		int n = scan.nextInt();
		int ans[]= new int[w+1];
		for(int i = 1; i <= w; i++)
		{
			ans [i]= i;
		}

		for(int i=0; i < n; i++)
		{
			
			String str = scan.next();
			StringTokenizer st = new StringTokenizer(str, ",");
			swap(ans, st.nextToken(),st.nextToken());
		}

		for(int i = 1; i <= w; i++)
		{
			System.out.println(ans[i]);
		}

	}

	public static void swap(int a[], String b, String c)
	{
	    int  tmp = a[Integer.valueOf(b)];
		a[Integer.valueOf(b)] = a[Integer.valueOf(c)];
		a[Integer.valueOf(c)] = tmp;
	}

} public class Main
{
	public static void main(String arg[])
	{
		Scanner scan = new Scanner(System.in);
		
	
		int w = scan.nextInt();
		int n = scan.nextInt();
		int ans[]= new int[w+1];
		for(int i = 1; i <= w; i++)
		{
			ans [i]= i;
		}

		for(int i=0; i < n; i++)
		{
			
			String str = scan.next();
			StringTokenizer st = new StringTokenizer(str, ",");
			swap(ans, st.nextToken(),st.nextToken());
		}

		for(int i = 1; i <= w; i++)
		{
			System.out.println(ans[i]);
		}

	}

	public static void swap(int a[], String b, String c)
	{
	    int  tmp = a[Integer.valueOf(b)];
		a[Integer.valueOf(b)] = a[Integer.valueOf(c)];
		a[Integer.valueOf(c)] = tmp;
	}

} Main
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String arg[])
	{
		Scanner scan = new Scanner(System.in);
		
	
		int w = scan.nextInt();
		int n = scan.nextInt();
		int ans[]= new int[w+1];
		for(int i = 1; i <= w; i++)
		{
			ans [i]= i;
		}

		for(int i=0; i < n; i++)
		{
			
			String str = scan.next();
			StringTokenizer st = new StringTokenizer(str, ",");
			swap(ans, st.nextToken(),st.nextToken());
		}

		for(int i = 1; i <= w; i++)
		{
			System.out.println(ans[i]);
		}

	}

	public static void swap(int a[], String b, String c)
	{
	    int  tmp = a[Integer.valueOf(b)];
		a[Integer.valueOf(b)] = a[Integer.valueOf(c)];
		a[Integer.valueOf(c)] = tmp;
	}

}