import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	int w=Integer.parseInt(input.readLine());
	int a[]=new int[w];
	for(int i=0;i<w;i++)
	    {
		a[i]=i+1;
	    }
	int n=Integer.parseInt(input.readLine());
	for(int i=0;i<n;i++)
	    {
		String str=input.readLine();
		String str_ary[]=str.split(",");
		int b[]=new int [2];
		
			b[0]=Integer.parseInt(str_ary[0])-1;
			b[1]=Integer.parseInt(str_ary[1])-1;
		int tmp=a[b[0]];
		a[b[0]]=a[b[1]];
		a[b[1]]=tmp;
	    }
for(int i=0;i<w;i++)
	    {
		System.out.println(a[i]);
	    }
    }
} import java.io.*; io.* java class Main
{
    public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	int w=Integer.parseInt(input.readLine());
	int a[]=new int[w];
	for(int i=0;i<w;i++)
	    {
		a[i]=i+1;
	    }
	int n=Integer.parseInt(input.readLine());
	for(int i=0;i<n;i++)
	    {
		String str=input.readLine();
		String str_ary[]=str.split(",");
		int b[]=new int [2];
		
			b[0]=Integer.parseInt(str_ary[0])-1;
			b[1]=Integer.parseInt(str_ary[1])-1;
		int tmp=a[b[0]];
		a[b[0]]=a[b[1]];
		a[b[1]]=tmp;
	    }
for(int i=0;i<w;i++)
	    {
		System.out.println(a[i]);
	    }
    }
} Main public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	int w=Integer.parseInt(input.readLine());
	int a[]=new int[w];
	for(int i=0;i<w;i++)
	    {
		a[i]=i+1;
	    }
	int n=Integer.parseInt(input.readLine());
	for(int i=0;i<n;i++)
	    {
		String str=input.readLine();
		String str_ary[]=str.split(",");
		int b[]=new int [2];
		
			b[0]=Integer.parseInt(str_ary[0])-1;
			b[1]=Integer.parseInt(str_ary[1])-1;
		int tmp=a[b[0]];
		a[b[0]]=a[b[1]];
		a[b[1]]=tmp;
	    }
for(int i=0;i<w;i++)
	    {
		System.out.println(a[i]);
	    }
    } main {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	int w=Integer.parseInt(input.readLine());
	int a[]=new int[w];
	for(int i=0;i<w;i++)
	    {
		a[i]=i+1;
	    }
	int n=Integer.parseInt(input.readLine());
	for(int i=0;i<n;i++)
	    {
		String str=input.readLine();
		String str_ary[]=str.split(",");
		int b[]=new int [2];
		
			b[0]=Integer.parseInt(str_ary[0])-1;
			b[1]=Integer.parseInt(str_ary[1])-1;
		int tmp=a[b[0]];
		a[b[0]]=a[b[1]];
		a[b[1]]=tmp;
	    }
for(int i=0;i<w;i++)
	    {
		System.out.println(a[i]);
	    }
    } BufferedReader input=new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) int w=Integer.parseInt(input.readLine()); w Integer.parseInt(input.readLine()) Integer.parseInt Integer input.readLine() input.readLine input int a[]=new int[w]; a new int[w] w for(int i=0;i<w;i++)
	    {
		a[i]=i+1;
	    } int i=0; int i=0; i 0 i<w i w i++ i++ i {
		a[i]=i+1;
	    } {
		a[i]=i+1;
	    } a[i]=i+1 a[i] a i i+1 i 1 int n=Integer.parseInt(input.readLine()); n Integer.parseInt(input.readLine()) Integer.parseInt Integer input.readLine() input.readLine input for(int i=0;i<n;i++)
	    {
		String str=input.readLine();
		String str_ary[]=str.split(",");
		int b[]=new int [2];
		
			b[0]=Integer.parseInt(str_ary[0])-1;
			b[1]=Integer.parseInt(str_ary[1])-1;
		int tmp=a[b[0]];
		a[b[0]]=a[b[1]];
		a[b[1]]=tmp;
	    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
		String str=input.readLine();
		String str_ary[]=str.split(",");
		int b[]=new int [2];
		
			b[0]=Integer.parseInt(str_ary[0])-1;
			b[1]=Integer.parseInt(str_ary[1])-1;
		int tmp=a[b[0]];
		a[b[0]]=a[b[1]];
		a[b[1]]=tmp;
	    } {
		String str=input.readLine();
		String str_ary[]=str.split(",");
		int b[]=new int [2];
		
			b[0]=Integer.parseInt(str_ary[0])-1;
			b[1]=Integer.parseInt(str_ary[1])-1;
		int tmp=a[b[0]];
		a[b[0]]=a[b[1]];
		a[b[1]]=tmp;
	    } String str=input.readLine(); str input.readLine() input.readLine input String str_ary[]=str.split(","); str_ary str.split(",") str.split str "," int b[]=new int [2]; b new int [2] 2 b[0]=Integer.parseInt(str_ary[0])-1 b[0] b 0 Integer.parseInt(str_ary[0])-1 Integer.parseInt(str_ary[0]) Integer.parseInt Integer str_ary[0] str_ary 0 1 b[1]=Integer.parseInt(str_ary[1])-1 b[1] b 1 Integer.parseInt(str_ary[1])-1 Integer.parseInt(str_ary[1]) Integer.parseInt Integer str_ary[1] str_ary 1 1 int tmp=a[b[0]]; tmp a[b[0]] a b[0] b 0 a[b[0]]=a[b[1]] a[b[0]] a b[0] b 0 a[b[1]] a b[1] b 1 a[b[1]]=tmp a[b[1]] a b[1] b 1 tmp for(int i=0;i<w;i++)
	    {
		System.out.println(a[i]);
	    } int i=0; int i=0; i 0 i<w i w i++ i++ i {
		System.out.println(a[i]);
	    } {
		System.out.println(a[i]);
	    } System.out.println(a[i]) System.out.println System.out System System.out a[i] a i String args[] args
import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	int w=Integer.parseInt(input.readLine());
	int a[]=new int[w];
	for(int i=0;i<w;i++)
	    {
		a[i]=i+1;
	    }
	int n=Integer.parseInt(input.readLine());
	for(int i=0;i<n;i++)
	    {
		String str=input.readLine();
		String str_ary[]=str.split(",");
		int b[]=new int [2];
		
			b[0]=Integer.parseInt(str_ary[0])-1;
			b[1]=Integer.parseInt(str_ary[1])-1;
		int tmp=a[b[0]];
		a[b[0]]=a[b[1]];
		a[b[1]]=tmp;
	    }
for(int i=0;i<w;i++)
	    {
		System.out.println(a[i]);
	    }
    }
}