
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.*;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main
{
	public static void main (String[] arg)throws IOException
	{
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		int[] a= new int[31];
		int[] b= new int[31];	
		int num = Integer.parseInt(input.readLine());
		int num2 = Integer.parseInt(input.readLine());
		for(int i=0;i<=30;i++){
           a[i]=i;
		}
		
		String[] change;
		for(int j=1;j<=num2;j++){
		change=input.readLine().split(",");
		int x1 = Integer.parseInt(change[0]);
        int y1 = Integer.parseInt(change[1]);
		int buffer;
		buffer=a[x1];
		a[x1]=a[y1];
		a[y1]=buffer;
		}
		for(int k=1;k<=num;k++){
			System.out.println(a[k]);
		}
	}
} import java.util.*; util.* java import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.lang.*; lang.* java import java.util.Scanner; Scanner java.util import java.util.StringTokenizer; StringTokenizer java.util public class Main
{
	public static void main (String[] arg)throws IOException
	{
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		int[] a= new int[31];
		int[] b= new int[31];	
		int num = Integer.parseInt(input.readLine());
		int num2 = Integer.parseInt(input.readLine());
		for(int i=0;i<=30;i++){
           a[i]=i;
		}
		
		String[] change;
		for(int j=1;j<=num2;j++){
		change=input.readLine().split(",");
		int x1 = Integer.parseInt(change[0]);
        int y1 = Integer.parseInt(change[1]);
		int buffer;
		buffer=a[x1];
		a[x1]=a[y1];
		a[y1]=buffer;
		}
		for(int k=1;k<=num;k++){
			System.out.println(a[k]);
		}
	}
} Main public static void main (String[] arg)throws IOException
	{
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		int[] a= new int[31];
		int[] b= new int[31];	
		int num = Integer.parseInt(input.readLine());
		int num2 = Integer.parseInt(input.readLine());
		for(int i=0;i<=30;i++){
           a[i]=i;
		}
		
		String[] change;
		for(int j=1;j<=num2;j++){
		change=input.readLine().split(",");
		int x1 = Integer.parseInt(change[0]);
        int y1 = Integer.parseInt(change[1]);
		int buffer;
		buffer=a[x1];
		a[x1]=a[y1];
		a[y1]=buffer;
		}
		for(int k=1;k<=num;k++){
			System.out.println(a[k]);
		}
	} main {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		int[] a= new int[31];
		int[] b= new int[31];	
		int num = Integer.parseInt(input.readLine());
		int num2 = Integer.parseInt(input.readLine());
		for(int i=0;i<=30;i++){
           a[i]=i;
		}
		
		String[] change;
		for(int j=1;j<=num2;j++){
		change=input.readLine().split(",");
		int x1 = Integer.parseInt(change[0]);
        int y1 = Integer.parseInt(change[1]);
		int buffer;
		buffer=a[x1];
		a[x1]=a[y1];
		a[y1]=buffer;
		}
		for(int k=1;k<=num;k++){
			System.out.println(a[k]);
		}
	} BufferedReader input =new BufferedReader (new InputStreamReader (System.in)); input new BufferedReader (new InputStreamReader (System.in)) int[] a= new int[31]; a new int[31] 31 int[] b= new int[31]; b new int[31] 31 int num = Integer.parseInt(input.readLine()); num Integer.parseInt(input.readLine()) Integer.parseInt Integer input.readLine() input.readLine input int num2 = Integer.parseInt(input.readLine()); num2 Integer.parseInt(input.readLine()) Integer.parseInt Integer input.readLine() input.readLine input for(int i=0;i<=30;i++){
           a[i]=i;
		} int i=0; int i=0; i 0 i<=30 i 30 i++ i++ i {
           a[i]=i;
		} {
           a[i]=i;
		} a[i]=i a[i] a i i String[] change; change for(int j=1;j<=num2;j++){
		change=input.readLine().split(",");
		int x1 = Integer.parseInt(change[0]);
        int y1 = Integer.parseInt(change[1]);
		int buffer;
		buffer=a[x1];
		a[x1]=a[y1];
		a[y1]=buffer;
		} int j=1; int j=1; j 1 j<=num2 j num2 j++ j++ j {
		change=input.readLine().split(",");
		int x1 = Integer.parseInt(change[0]);
        int y1 = Integer.parseInt(change[1]);
		int buffer;
		buffer=a[x1];
		a[x1]=a[y1];
		a[y1]=buffer;
		} {
		change=input.readLine().split(",");
		int x1 = Integer.parseInt(change[0]);
        int y1 = Integer.parseInt(change[1]);
		int buffer;
		buffer=a[x1];
		a[x1]=a[y1];
		a[y1]=buffer;
		} change=input.readLine().split(",") change input.readLine().split(",") input.readLine().split input.readLine() input.readLine input "," int x1 = Integer.parseInt(change[0]); x1 Integer.parseInt(change[0]) Integer.parseInt Integer change[0] change 0 int y1 = Integer.parseInt(change[1]); y1 Integer.parseInt(change[1]) Integer.parseInt Integer change[1] change 1 int buffer; buffer buffer=a[x1] buffer a[x1] a x1 a[x1]=a[y1] a[x1] a x1 a[y1] a y1 a[y1]=buffer a[y1] a y1 buffer for(int k=1;k<=num;k++){
			System.out.println(a[k]);
		} int k=1; int k=1; k 1 k<=num k num k++ k++ k {
			System.out.println(a[k]);
		} {
			System.out.println(a[k]);
		} System.out.println(a[k]) System.out.println System.out System System.out a[k] a k String[] arg arg public class Main
{
	public static void main (String[] arg)throws IOException
	{
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		int[] a= new int[31];
		int[] b= new int[31];	
		int num = Integer.parseInt(input.readLine());
		int num2 = Integer.parseInt(input.readLine());
		for(int i=0;i<=30;i++){
           a[i]=i;
		}
		
		String[] change;
		for(int j=1;j<=num2;j++){
		change=input.readLine().split(",");
		int x1 = Integer.parseInt(change[0]);
        int y1 = Integer.parseInt(change[1]);
		int buffer;
		buffer=a[x1];
		a[x1]=a[y1];
		a[y1]=buffer;
		}
		for(int k=1;k<=num;k++){
			System.out.println(a[k]);
		}
	}
} public class Main
{
	public static void main (String[] arg)throws IOException
	{
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		int[] a= new int[31];
		int[] b= new int[31];	
		int num = Integer.parseInt(input.readLine());
		int num2 = Integer.parseInt(input.readLine());
		for(int i=0;i<=30;i++){
           a[i]=i;
		}
		
		String[] change;
		for(int j=1;j<=num2;j++){
		change=input.readLine().split(",");
		int x1 = Integer.parseInt(change[0]);
        int y1 = Integer.parseInt(change[1]);
		int buffer;
		buffer=a[x1];
		a[x1]=a[y1];
		a[y1]=buffer;
		}
		for(int k=1;k<=num;k++){
			System.out.println(a[k]);
		}
	}
} Main

import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.*;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main
{
	public static void main (String[] arg)throws IOException
	{
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		int[] a= new int[31];
		int[] b= new int[31];	
		int num = Integer.parseInt(input.readLine());
		int num2 = Integer.parseInt(input.readLine());
		for(int i=0;i<=30;i++){
           a[i]=i;
		}
		
		String[] change;
		for(int j=1;j<=num2;j++){
		change=input.readLine().split(",");
		int x1 = Integer.parseInt(change[0]);
        int y1 = Integer.parseInt(change[1]);
		int buffer;
		buffer=a[x1];
		a[x1]=a[y1];
		a[y1]=buffer;
		}
		for(int k=1;k<=num;k++){
			System.out.println(a[k]);
		}
	}
}