import java.util.*;
import java.io.*;
public class Main{
  public  static void main(String[] args)throws IOException{
	InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br=new BufferedReader(isr);
		String ad=br.readLine();
		String bd=br.readLine();
		int w = Integer.parseInt(ad);
		int n = Integer.parseInt(bd);
		int[] amida=new int[w+1];
		for(int i=1;i<=w;i++)
		    amida[i]=i;
		for(int i=0;i<n;i++){
		StringTokenizer st = new StringTokenizer(br.readLine(),",");
		int a=Integer.parseInt(st.nextToken());
		int b=Integer.parseInt(st.nextToken());
		int t=amida[a];
		amida[a]=amida[b];
		amida[b]=t;
		}
		for(int i=1;i<=w;i++)
		    System.out.println(amida[i]);
		
  }
    
} import java.util.*; util.* java import java.io.*; io.* java public class Main{
  public  static void main(String[] args)throws IOException{
	InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br=new BufferedReader(isr);
		String ad=br.readLine();
		String bd=br.readLine();
		int w = Integer.parseInt(ad);
		int n = Integer.parseInt(bd);
		int[] amida=new int[w+1];
		for(int i=1;i<=w;i++)
		    amida[i]=i;
		for(int i=0;i<n;i++){
		StringTokenizer st = new StringTokenizer(br.readLine(),",");
		int a=Integer.parseInt(st.nextToken());
		int b=Integer.parseInt(st.nextToken());
		int t=amida[a];
		amida[a]=amida[b];
		amida[b]=t;
		}
		for(int i=1;i<=w;i++)
		    System.out.println(amida[i]);
		
  }
    
} Main public  static void main(String[] args)throws IOException{
	InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br=new BufferedReader(isr);
		String ad=br.readLine();
		String bd=br.readLine();
		int w = Integer.parseInt(ad);
		int n = Integer.parseInt(bd);
		int[] amida=new int[w+1];
		for(int i=1;i<=w;i++)
		    amida[i]=i;
		for(int i=0;i<n;i++){
		StringTokenizer st = new StringTokenizer(br.readLine(),",");
		int a=Integer.parseInt(st.nextToken());
		int b=Integer.parseInt(st.nextToken());
		int t=amida[a];
		amida[a]=amida[b];
		amida[b]=t;
		}
		for(int i=1;i<=w;i++)
		    System.out.println(amida[i]);
		
  } main {
	InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br=new BufferedReader(isr);
		String ad=br.readLine();
		String bd=br.readLine();
		int w = Integer.parseInt(ad);
		int n = Integer.parseInt(bd);
		int[] amida=new int[w+1];
		for(int i=1;i<=w;i++)
		    amida[i]=i;
		for(int i=0;i<n;i++){
		StringTokenizer st = new StringTokenizer(br.readLine(),",");
		int a=Integer.parseInt(st.nextToken());
		int b=Integer.parseInt(st.nextToken());
		int t=amida[a];
		amida[a]=amida[b];
		amida[b]=t;
		}
		for(int i=1;i<=w;i++)
		    System.out.println(amida[i]);
		
  } InputStreamReader isr = new InputStreamReader(System.in); isr new InputStreamReader(System.in) BufferedReader br=new BufferedReader(isr); br new BufferedReader(isr) String ad=br.readLine(); ad br.readLine() br.readLine br String bd=br.readLine(); bd br.readLine() br.readLine br int w = Integer.parseInt(ad); w Integer.parseInt(ad) Integer.parseInt Integer ad int n = Integer.parseInt(bd); n Integer.parseInt(bd) Integer.parseInt Integer bd int[] amida=new int[w+1]; amida new int[w+1] w+1 w 1 for(int i=1;i<=w;i++)
		    amida[i]=i; int i=1; int i=1; i 1 i<=w i w i++ i++ i amida[i]=i; amida[i]=i amida[i] amida i i for(int i=0;i<n;i++){
		StringTokenizer st = new StringTokenizer(br.readLine(),",");
		int a=Integer.parseInt(st.nextToken());
		int b=Integer.parseInt(st.nextToken());
		int t=amida[a];
		amida[a]=amida[b];
		amida[b]=t;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
		StringTokenizer st = new StringTokenizer(br.readLine(),",");
		int a=Integer.parseInt(st.nextToken());
		int b=Integer.parseInt(st.nextToken());
		int t=amida[a];
		amida[a]=amida[b];
		amida[b]=t;
		} {
		StringTokenizer st = new StringTokenizer(br.readLine(),",");
		int a=Integer.parseInt(st.nextToken());
		int b=Integer.parseInt(st.nextToken());
		int t=amida[a];
		amida[a]=amida[b];
		amida[b]=t;
		} StringTokenizer st = new StringTokenizer(br.readLine(),","); st new StringTokenizer(br.readLine(),",") int a=Integer.parseInt(st.nextToken()); a Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int b=Integer.parseInt(st.nextToken()); b Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int t=amida[a]; t amida[a] amida a amida[a]=amida[b] amida[a] amida a amida[b] amida b amida[b]=t amida[b] amida b t for(int i=1;i<=w;i++)
		    System.out.println(amida[i]); int i=1; int i=1; i 1 i<=w i w i++ i++ i System.out.println(amida[i]); System.out.println(amida[i]) System.out.println System.out System System.out amida[i] amida i String[] args args public class Main{
  public  static void main(String[] args)throws IOException{
	InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br=new BufferedReader(isr);
		String ad=br.readLine();
		String bd=br.readLine();
		int w = Integer.parseInt(ad);
		int n = Integer.parseInt(bd);
		int[] amida=new int[w+1];
		for(int i=1;i<=w;i++)
		    amida[i]=i;
		for(int i=0;i<n;i++){
		StringTokenizer st = new StringTokenizer(br.readLine(),",");
		int a=Integer.parseInt(st.nextToken());
		int b=Integer.parseInt(st.nextToken());
		int t=amida[a];
		amida[a]=amida[b];
		amida[b]=t;
		}
		for(int i=1;i<=w;i++)
		    System.out.println(amida[i]);
		
  }
    
} public class Main{
  public  static void main(String[] args)throws IOException{
	InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br=new BufferedReader(isr);
		String ad=br.readLine();
		String bd=br.readLine();
		int w = Integer.parseInt(ad);
		int n = Integer.parseInt(bd);
		int[] amida=new int[w+1];
		for(int i=1;i<=w;i++)
		    amida[i]=i;
		for(int i=0;i<n;i++){
		StringTokenizer st = new StringTokenizer(br.readLine(),",");
		int a=Integer.parseInt(st.nextToken());
		int b=Integer.parseInt(st.nextToken());
		int t=amida[a];
		amida[a]=amida[b];
		amida[b]=t;
		}
		for(int i=1;i<=w;i++)
		    System.out.println(amida[i]);
		
  }
    
} Main
import java.util.*;
import java.io.*;
public class Main{
  public  static void main(String[] args)throws IOException{
	InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br=new BufferedReader(isr);
		String ad=br.readLine();
		String bd=br.readLine();
		int w = Integer.parseInt(ad);
		int n = Integer.parseInt(bd);
		int[] amida=new int[w+1];
		for(int i=1;i<=w;i++)
		    amida[i]=i;
		for(int i=0;i<n;i++){
		StringTokenizer st = new StringTokenizer(br.readLine(),",");
		int a=Integer.parseInt(st.nextToken());
		int b=Integer.parseInt(st.nextToken());
		int t=amida[a];
		amida[a]=amida[b];
		amida[b]=t;
		}
		for(int i=1;i<=w;i++)
		    System.out.println(amida[i]);
		
  }
    
}