import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args)throws IOException{
        InputStreamReader isr =new InputStreamReader(System.in);
   		BufferedReader reader =new BufferedReader(isr);
    	
        /*???????????¬??°w???????????????*/
        String buf = reader.readLine();
        int w = Integer.parseInt(buf);
        
        /*?¨??£??????¬??°n???????????????*/
        buf = reader.readLine();
        int n = Integer.parseInt(buf);
        
        int i;
        int[] num = new int[w];
        
        for (i = 0;i < w;i++) {
            num[i] = i + 1;
        }
        
        for (i = 0;i < n;i++) {
            /*i??????????¨??£????????????????*/
            buf = reader.readLine();
            StringTokenizer st = new StringTokenizer(buf,",");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int x = num[a - 1];
            num[a - 1] = num[b - 1];
            num[b - 1] = x;
        }
        
        for (i = 0;i < w;i++) System.out.println(num[i]);
    }
} import java.io.*; io.* java import java.util.*; util.* java class Main{
    public static void main(String[] args)throws IOException{
        InputStreamReader isr =new InputStreamReader(System.in);
   		BufferedReader reader =new BufferedReader(isr);
    	
        /*???????????¬??°w???????????????*/
        String buf = reader.readLine();
        int w = Integer.parseInt(buf);
        
        /*?¨??£??????¬??°n???????????????*/
        buf = reader.readLine();
        int n = Integer.parseInt(buf);
        
        int i;
        int[] num = new int[w];
        
        for (i = 0;i < w;i++) {
            num[i] = i + 1;
        }
        
        for (i = 0;i < n;i++) {
            /*i??????????¨??£????????????????*/
            buf = reader.readLine();
            StringTokenizer st = new StringTokenizer(buf,",");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int x = num[a - 1];
            num[a - 1] = num[b - 1];
            num[b - 1] = x;
        }
        
        for (i = 0;i < w;i++) System.out.println(num[i]);
    }
} Main public static void main(String[] args)throws IOException{
        InputStreamReader isr =new InputStreamReader(System.in);
   		BufferedReader reader =new BufferedReader(isr);
    	
        /*???????????¬??°w???????????????*/
        String buf = reader.readLine();
        int w = Integer.parseInt(buf);
        
        /*?¨??£??????¬??°n???????????????*/
        buf = reader.readLine();
        int n = Integer.parseInt(buf);
        
        int i;
        int[] num = new int[w];
        
        for (i = 0;i < w;i++) {
            num[i] = i + 1;
        }
        
        for (i = 0;i < n;i++) {
            /*i??????????¨??£????????????????*/
            buf = reader.readLine();
            StringTokenizer st = new StringTokenizer(buf,",");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int x = num[a - 1];
            num[a - 1] = num[b - 1];
            num[b - 1] = x;
        }
        
        for (i = 0;i < w;i++) System.out.println(num[i]);
    } main {
        InputStreamReader isr =new InputStreamReader(System.in);
   		BufferedReader reader =new BufferedReader(isr);
    	
        /*???????????¬??°w???????????????*/
        String buf = reader.readLine();
        int w = Integer.parseInt(buf);
        
        /*?¨??£??????¬??°n???????????????*/
        buf = reader.readLine();
        int n = Integer.parseInt(buf);
        
        int i;
        int[] num = new int[w];
        
        for (i = 0;i < w;i++) {
            num[i] = i + 1;
        }
        
        for (i = 0;i < n;i++) {
            /*i??????????¨??£????????????????*/
            buf = reader.readLine();
            StringTokenizer st = new StringTokenizer(buf,",");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int x = num[a - 1];
            num[a - 1] = num[b - 1];
            num[b - 1] = x;
        }
        
        for (i = 0;i < w;i++) System.out.println(num[i]);
    } InputStreamReader isr =new InputStreamReader(System.in); isr new InputStreamReader(System.in) BufferedReader reader =new BufferedReader(isr); reader new BufferedReader(isr) String buf = reader.readLine(); buf reader.readLine() reader.readLine reader int w = Integer.parseInt(buf); w Integer.parseInt(buf) Integer.parseInt Integer buf buf = reader.readLine() buf reader.readLine() reader.readLine reader int n = Integer.parseInt(buf); n Integer.parseInt(buf) Integer.parseInt Integer buf int i; i int[] num = new int[w]; num new int[w] w for (i = 0;i < w;i++) {
            num[i] = i + 1;
        } i = 0; i = 0 i 0 i < w i w i++ i++ i {
            num[i] = i + 1;
        } {
            num[i] = i + 1;
        } num[i] = i + 1 num[i] num i i + 1 i 1 for (i = 0;i < n;i++) {
            /*i??????????¨??£????????????????*/
            buf = reader.readLine();
            StringTokenizer st = new StringTokenizer(buf,",");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int x = num[a - 1];
            num[a - 1] = num[b - 1];
            num[b - 1] = x;
        } i = 0; i = 0 i 0 i < n i n i++ i++ i {
            /*i??????????¨??£????????????????*/
            buf = reader.readLine();
            StringTokenizer st = new StringTokenizer(buf,",");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int x = num[a - 1];
            num[a - 1] = num[b - 1];
            num[b - 1] = x;
        } {
            /*i??????????¨??£????????????????*/
            buf = reader.readLine();
            StringTokenizer st = new StringTokenizer(buf,",");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int x = num[a - 1];
            num[a - 1] = num[b - 1];
            num[b - 1] = x;
        } buf = reader.readLine() buf reader.readLine() reader.readLine reader StringTokenizer st = new StringTokenizer(buf,","); st new StringTokenizer(buf,",") 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 x = num[a - 1]; x num[a - 1] num a - 1 a 1 num[a - 1] = num[b - 1] num[a - 1] num a - 1 a 1 num[b - 1] num b - 1 b 1 num[b - 1] = x num[b - 1] num b - 1 b 1 x for (i = 0;i < w;i++) System.out.println(num[i]); i = 0; i = 0 i 0 i < w i w i++ i++ i System.out.println(num[i]); System.out.println(num[i]) System.out.println System.out System System.out num[i] num i String[] args args
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args)throws IOException{
        InputStreamReader isr =new InputStreamReader(System.in);
   		BufferedReader reader =new BufferedReader(isr);
    	
        /*???????????¬??°w???????????????*/
        String buf = reader.readLine();
        int w = Integer.parseInt(buf);
        
        /*?¨??£??????¬??°n???????????????*/
        buf = reader.readLine();
        int n = Integer.parseInt(buf);
        
        int i;
        int[] num = new int[w];
        
        for (i = 0;i < w;i++) {
            num[i] = i + 1;
        }
        
        for (i = 0;i < n;i++) {
            /*i??????????¨??£????????????????*/
            buf = reader.readLine();
            StringTokenizer st = new StringTokenizer(buf,",");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int x = num[a - 1];
            num[a - 1] = num[b - 1];
            num[b - 1] = x;
        }
        
        for (i = 0;i < w;i++) System.out.println(num[i]);
    }
}