import java.io.*;

class Main {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
       
            int w = Integer.parseInt(br.readLine());
            int[] amida = new int[w+1];
            amida[0]=0;
            for(int i=0; i<=w; i++){
                amida[i] = i; 
            }
            int a,b;
            int temp;
            int n = Integer.parseInt(br.readLine());
            for(int i=0; i<n; i++){
                String[] values = br.readLine().split(",");
                a = Integer.parseInt(values[0]);
                b = Integer.parseInt(values[1]);
                
                temp = amida[a];
                amida[a] = amida[b];
                amida[b] = temp;
            }
            
            for(int i=1; i<=w; i++){
                System.out.println(amida[i]);
            }
            
        
        
    }
} import java.io.*; io.* java class Main {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
       
            int w = Integer.parseInt(br.readLine());
            int[] amida = new int[w+1];
            amida[0]=0;
            for(int i=0; i<=w; i++){
                amida[i] = i; 
            }
            int a,b;
            int temp;
            int n = Integer.parseInt(br.readLine());
            for(int i=0; i<n; i++){
                String[] values = br.readLine().split(",");
                a = Integer.parseInt(values[0]);
                b = Integer.parseInt(values[1]);
                
                temp = amida[a];
                amida[a] = amida[b];
                amida[b] = temp;
            }
            
            for(int i=1; i<=w; i++){
                System.out.println(amida[i]);
            }
            
        
        
    }
} Main public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
       
            int w = Integer.parseInt(br.readLine());
            int[] amida = new int[w+1];
            amida[0]=0;
            for(int i=0; i<=w; i++){
                amida[i] = i; 
            }
            int a,b;
            int temp;
            int n = Integer.parseInt(br.readLine());
            for(int i=0; i<n; i++){
                String[] values = br.readLine().split(",");
                a = Integer.parseInt(values[0]);
                b = Integer.parseInt(values[1]);
                
                temp = amida[a];
                amida[a] = amida[b];
                amida[b] = temp;
            }
            
            for(int i=1; i<=w; i++){
                System.out.println(amida[i]);
            }
            
        
        
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
       
            int w = Integer.parseInt(br.readLine());
            int[] amida = new int[w+1];
            amida[0]=0;
            for(int i=0; i<=w; i++){
                amida[i] = i; 
            }
            int a,b;
            int temp;
            int n = Integer.parseInt(br.readLine());
            for(int i=0; i<n; i++){
                String[] values = br.readLine().split(",");
                a = Integer.parseInt(values[0]);
                b = Integer.parseInt(values[1]);
                
                temp = amida[a];
                amida[a] = amida[b];
                amida[b] = temp;
            }
            
            for(int i=1; i<=w; i++){
                System.out.println(amida[i]);
            }
            
        
        
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int w = Integer.parseInt(br.readLine()); w Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] amida = new int[w+1]; amida new int[w+1] w+1 w 1 amida[0]=0 amida[0] amida 0 0 for(int i=0; i<=w; i++){
                amida[i] = i; 
            } int i=0; int i=0; i 0 i<=w i w i++ i++ i {
                amida[i] = i; 
            } {
                amida[i] = i; 
            } amida[i] = i amida[i] amida i i int a a b; b int temp; temp int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for(int i=0; i<n; i++){
                String[] values = br.readLine().split(",");
                a = Integer.parseInt(values[0]);
                b = Integer.parseInt(values[1]);
                
                temp = amida[a];
                amida[a] = amida[b];
                amida[b] = temp;
            } int i=0; int i=0; i 0 i<n i n i++ i++ i {
                String[] values = br.readLine().split(",");
                a = Integer.parseInt(values[0]);
                b = Integer.parseInt(values[1]);
                
                temp = amida[a];
                amida[a] = amida[b];
                amida[b] = temp;
            } {
                String[] values = br.readLine().split(",");
                a = Integer.parseInt(values[0]);
                b = Integer.parseInt(values[1]);
                
                temp = amida[a];
                amida[a] = amida[b];
                amida[b] = temp;
            } String[] values = br.readLine().split(","); values br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," a = Integer.parseInt(values[0]) a Integer.parseInt(values[0]) Integer.parseInt Integer values[0] values 0 b = Integer.parseInt(values[1]) b Integer.parseInt(values[1]) Integer.parseInt Integer values[1] values 1 temp = amida[a] temp amida[a] amida a amida[a] = amida[b] amida[a] amida a amida[b] amida b amida[b] = temp amida[b] amida b temp 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(amida[i]) System.out.println System.out System System.out amida[i] amida i String[] args args
import java.io.*;

class Main {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
       
            int w = Integer.parseInt(br.readLine());
            int[] amida = new int[w+1];
            amida[0]=0;
            for(int i=0; i<=w; i++){
                amida[i] = i; 
            }
            int a,b;
            int temp;
            int n = Integer.parseInt(br.readLine());
            for(int i=0; i<n; i++){
                String[] values = br.readLine().split(",");
                a = Integer.parseInt(values[0]);
                b = Integer.parseInt(values[1]);
                
                temp = amida[a];
                amida[a] = amida[b];
                amida[b] = temp;
            }
            
            for(int i=1; i<=w; i++){
                System.out.println(amida[i]);
            }
            
        
        
    }
}