import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
 
  
  
  
public class Main {
    
    
    public static void main(String[] args) {
         
        try {
            
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
            String s;
            List<Integer> List = new ArrayList<Integer>();  
            
            int verticalNum = Integer.parseInt(br.readLine());
           
            for(int i = 1; i<=verticalNum; i++)
            {
            	List.add(i);
            }
            int horizontalNum = Integer.parseInt(br.readLine());
            
            for(int i = 0; i<horizontalNum; i++)
            {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            }
            
            for(int i = 0; i<List.size(); i++)
            {
            	System.out.println(List.get(i));
            }
     
        }catch (Exception e) {
            e.printStackTrace();
        }
         
    }
    
   
    
  
} import java.io.*; io.* java import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    
    
    public static void main(String[] args) {
         
        try {
            
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
            String s;
            List<Integer> List = new ArrayList<Integer>();  
            
            int verticalNum = Integer.parseInt(br.readLine());
           
            for(int i = 1; i<=verticalNum; i++)
            {
            	List.add(i);
            }
            int horizontalNum = Integer.parseInt(br.readLine());
            
            for(int i = 0; i<horizontalNum; i++)
            {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            }
            
            for(int i = 0; i<List.size(); i++)
            {
            	System.out.println(List.get(i));
            }
     
        }catch (Exception e) {
            e.printStackTrace();
        }
         
    }
    
   
    
  
} Main public static void main(String[] args) {
         
        try {
            
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
            String s;
            List<Integer> List = new ArrayList<Integer>();  
            
            int verticalNum = Integer.parseInt(br.readLine());
           
            for(int i = 1; i<=verticalNum; i++)
            {
            	List.add(i);
            }
            int horizontalNum = Integer.parseInt(br.readLine());
            
            for(int i = 0; i<horizontalNum; i++)
            {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            }
            
            for(int i = 0; i<List.size(); i++)
            {
            	System.out.println(List.get(i));
            }
     
        }catch (Exception e) {
            e.printStackTrace();
        }
         
    } main {
         
        try {
            
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
            String s;
            List<Integer> List = new ArrayList<Integer>();  
            
            int verticalNum = Integer.parseInt(br.readLine());
           
            for(int i = 1; i<=verticalNum; i++)
            {
            	List.add(i);
            }
            int horizontalNum = Integer.parseInt(br.readLine());
            
            for(int i = 0; i<horizontalNum; i++)
            {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            }
            
            for(int i = 0; i<List.size(); i++)
            {
            	System.out.println(List.get(i));
            }
     
        }catch (Exception e) {
            e.printStackTrace();
        }
         
    } try {
            
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
            String s;
            List<Integer> List = new ArrayList<Integer>();  
            
            int verticalNum = Integer.parseInt(br.readLine());
           
            for(int i = 1; i<=verticalNum; i++)
            {
            	List.add(i);
            }
            int horizontalNum = Integer.parseInt(br.readLine());
            
            for(int i = 0; i<horizontalNum; i++)
            {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            }
            
            for(int i = 0; i<List.size(); i++)
            {
            	System.out.println(List.get(i));
            }
     
        }catch (Exception e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } Exception e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
            String s;
            List<Integer> List = new ArrayList<Integer>();  
            
            int verticalNum = Integer.parseInt(br.readLine());
           
            for(int i = 1; i<=verticalNum; i++)
            {
            	List.add(i);
            }
            int horizontalNum = Integer.parseInt(br.readLine());
            
            for(int i = 0; i<horizontalNum; i++)
            {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            }
            
            for(int i = 0; i<List.size(); i++)
            {
            	System.out.println(List.get(i));
            }
     
        } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s; s List<Integer> List = new ArrayList<Integer>(); List new ArrayList<Integer>() int verticalNum = Integer.parseInt(br.readLine()); verticalNum Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for(int i = 1; i<=verticalNum; i++)
            {
            	List.add(i);
            } int i = 1; int i = 1; i 1 i<=verticalNum i verticalNum i++ i++ i {
            	List.add(i);
            } {
            	List.add(i);
            } List.add(i) List.add List i int horizontalNum = Integer.parseInt(br.readLine()); horizontalNum Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for(int i = 0; i<horizontalNum; i++)
            {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            } int i = 0; int i = 0; i 0 i<horizontalNum i horizontalNum i++ i++ i {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            } {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            } s = br.readLine() s br.readLine() br.readLine br StringTokenizer st = new StringTokenizer(s,","); st new StringTokenizer(s,",") int a = Integer.parseInt(st.nextToken()) - 1; a Integer.parseInt(st.nextToken()) - 1 Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st 1 int b = Integer.parseInt(st.nextToken()) - 1; b Integer.parseInt(st.nextToken()) - 1 Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st 1 int temp = 0; temp 0 temp = List.get(a) temp List.get(a) List.get List a List.set(a,List.get(b)) List.set List a List.get(b) List.get List b List.set(b, temp) List.set List b temp for(int i = 0; i<List.size(); i++)
            {
            	System.out.println(List.get(i));
            } int i = 0; int i = 0; i 0 i<List.size() i List.size() List.size List i++ i++ i {
            	System.out.println(List.get(i));
            } {
            	System.out.println(List.get(i));
            } System.out.println(List.get(i)) System.out.println System.out System System.out List.get(i) List.get List i String[] args args public class Main {
    
    
    public static void main(String[] args) {
         
        try {
            
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
            String s;
            List<Integer> List = new ArrayList<Integer>();  
            
            int verticalNum = Integer.parseInt(br.readLine());
           
            for(int i = 1; i<=verticalNum; i++)
            {
            	List.add(i);
            }
            int horizontalNum = Integer.parseInt(br.readLine());
            
            for(int i = 0; i<horizontalNum; i++)
            {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            }
            
            for(int i = 0; i<List.size(); i++)
            {
            	System.out.println(List.get(i));
            }
     
        }catch (Exception e) {
            e.printStackTrace();
        }
         
    }
    
   
    
  
} public class Main {
    
    
    public static void main(String[] args) {
         
        try {
            
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
            String s;
            List<Integer> List = new ArrayList<Integer>();  
            
            int verticalNum = Integer.parseInt(br.readLine());
           
            for(int i = 1; i<=verticalNum; i++)
            {
            	List.add(i);
            }
            int horizontalNum = Integer.parseInt(br.readLine());
            
            for(int i = 0; i<horizontalNum; i++)
            {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            }
            
            for(int i = 0; i<List.size(); i++)
            {
            	System.out.println(List.get(i));
            }
     
        }catch (Exception e) {
            e.printStackTrace();
        }
         
    }
    
   
    
  
} Main
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
 
  
  
  
public class Main {
    
    
    public static void main(String[] args) {
         
        try {
            
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
            String s;
            List<Integer> List = new ArrayList<Integer>();  
            
            int verticalNum = Integer.parseInt(br.readLine());
           
            for(int i = 1; i<=verticalNum; i++)
            {
            	List.add(i);
            }
            int horizontalNum = Integer.parseInt(br.readLine());
            
            for(int i = 0; i<horizontalNum; i++)
            {
            	s = br.readLine();
            	StringTokenizer st = new StringTokenizer(s,",");
            
            	int a = Integer.parseInt(st.nextToken()) - 1;
                int b = Integer.parseInt(st.nextToken()) - 1;
                int temp = 0;
                
                temp = List.get(a);
                List.set(a,List.get(b));
                List.set(b, temp);
                     
            }
            
            for(int i = 0; i<List.size(); i++)
            {
            	System.out.println(List.get(i));
            }
     
        }catch (Exception e) {
            e.printStackTrace();
        }
         
    }
    
   
    
  
}