import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

public 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 n = Integer.parseInt(br.readLine());

        int[] array = new int[w];
        for(int i = 0; i < w; i++){
            array[i] = i+1;
        }

        for(int i = 0; i < n; i++){
           String[] input = br.readLine().split(",");
           int a = Integer.parseInt(input[0]);
           int b = Integer.parseInt(input[1]); 
           
           int tmp = array[a-1];
           array[a-1] = array[b-1];
           array[b-1] = tmp;
        }

        for(int i : array){
            System.out.println(i);
        }
    }
} import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.BufferedReader; BufferedReader java.io public 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 n = Integer.parseInt(br.readLine());

        int[] array = new int[w];
        for(int i = 0; i < w; i++){
            array[i] = i+1;
        }

        for(int i = 0; i < n; i++){
           String[] input = br.readLine().split(",");
           int a = Integer.parseInt(input[0]);
           int b = Integer.parseInt(input[1]); 
           
           int tmp = array[a-1];
           array[a-1] = array[b-1];
           array[b-1] = tmp;
        }

        for(int i : array){
            System.out.println(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 n = Integer.parseInt(br.readLine());

        int[] array = new int[w];
        for(int i = 0; i < w; i++){
            array[i] = i+1;
        }

        for(int i = 0; i < n; i++){
           String[] input = br.readLine().split(",");
           int a = Integer.parseInt(input[0]);
           int b = Integer.parseInt(input[1]); 
           
           int tmp = array[a-1];
           array[a-1] = array[b-1];
           array[b-1] = tmp;
        }

        for(int i : array){
            System.out.println(i);
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int w = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(br.readLine());

        int[] array = new int[w];
        for(int i = 0; i < w; i++){
            array[i] = i+1;
        }

        for(int i = 0; i < n; i++){
           String[] input = br.readLine().split(",");
           int a = Integer.parseInt(input[0]);
           int b = Integer.parseInt(input[1]); 
           
           int tmp = array[a-1];
           array[a-1] = array[b-1];
           array[b-1] = tmp;
        }

        for(int i : array){
            System.out.println(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 n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] array = new int[w]; array new int[w] w for(int i = 0; i < w; i++){
            array[i] = i+1;
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            array[i] = i+1;
        } {
            array[i] = i+1;
        } array[i] = i+1 array[i] array i i+1 i 1 for(int i = 0; i < n; i++){
           String[] input = br.readLine().split(",");
           int a = Integer.parseInt(input[0]);
           int b = Integer.parseInt(input[1]); 
           
           int tmp = array[a-1];
           array[a-1] = array[b-1];
           array[b-1] = tmp;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
           String[] input = br.readLine().split(",");
           int a = Integer.parseInt(input[0]);
           int b = Integer.parseInt(input[1]); 
           
           int tmp = array[a-1];
           array[a-1] = array[b-1];
           array[b-1] = tmp;
        } {
           String[] input = br.readLine().split(",");
           int a = Integer.parseInt(input[0]);
           int b = Integer.parseInt(input[1]); 
           
           int tmp = array[a-1];
           array[a-1] = array[b-1];
           array[b-1] = tmp;
        } String[] input = br.readLine().split(","); input br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," int a = Integer.parseInt(input[0]); a Integer.parseInt(input[0]) Integer.parseInt Integer input[0] input 0 int b = Integer.parseInt(input[1]); b Integer.parseInt(input[1]) Integer.parseInt Integer input[1] input 1 int tmp = array[a-1]; tmp array[a-1] array a-1 a 1 array[a-1] = array[b-1] array[a-1] array a-1 a 1 array[b-1] array b-1 b 1 array[b-1] = tmp array[b-1] array b-1 b 1 tmp for(int i : array){
            System.out.println(i);
        } int i array {
            System.out.println(i);
        } {
            System.out.println(i);
        } System.out.println(i) System.out.println System.out System System.out i String[] args args public 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 n = Integer.parseInt(br.readLine());

        int[] array = new int[w];
        for(int i = 0; i < w; i++){
            array[i] = i+1;
        }

        for(int i = 0; i < n; i++){
           String[] input = br.readLine().split(",");
           int a = Integer.parseInt(input[0]);
           int b = Integer.parseInt(input[1]); 
           
           int tmp = array[a-1];
           array[a-1] = array[b-1];
           array[b-1] = tmp;
        }

        for(int i : array){
            System.out.println(i);
        }
    }
} public 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 n = Integer.parseInt(br.readLine());

        int[] array = new int[w];
        for(int i = 0; i < w; i++){
            array[i] = i+1;
        }

        for(int i = 0; i < n; i++){
           String[] input = br.readLine().split(",");
           int a = Integer.parseInt(input[0]);
           int b = Integer.parseInt(input[1]); 
           
           int tmp = array[a-1];
           array[a-1] = array[b-1];
           array[b-1] = tmp;
        }

        for(int i : array){
            System.out.println(i);
        }
    }
} Main
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

public 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 n = Integer.parseInt(br.readLine());

        int[] array = new int[w];
        for(int i = 0; i < w; i++){
            array[i] = i+1;
        }

        for(int i = 0; i < n; i++){
           String[] input = br.readLine().split(",");
           int a = Integer.parseInt(input[0]);
           int b = Integer.parseInt(input[1]); 
           
           int tmp = array[a-1];
           array[a-1] = array[b-1];
           array[b-1] = tmp;
        }

        for(int i : array){
            System.out.println(i);
        }
    }
}