import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt();//縦線の数
        int n = scan.nextInt();//横線の本数
        int[] amida = new int[w];
        int copy = 0;
        for(int i=0;i<amida.length;i++){
            amida[i] = i+1;
        }
        while(n-->0){
            String str = scan.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            copy = amida[a];
            amida[a] = amida[b];
            amida[b] = copy;
        }
        for(int s: amida){
            System.out.println(s);
        }
    }

} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt();//縦線の数
        int n = scan.nextInt();//横線の本数
        int[] amida = new int[w];
        int copy = 0;
        for(int i=0;i<amida.length;i++){
            amida[i] = i+1;
        }
        while(n-->0){
            String str = scan.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            copy = amida[a];
            amida[a] = amida[b];
            amida[b] = copy;
        }
        for(int s: amida){
            System.out.println(s);
        }
    }

} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt();//縦線の数
        int n = scan.nextInt();//横線の本数
        int[] amida = new int[w];
        int copy = 0;
        for(int i=0;i<amida.length;i++){
            amida[i] = i+1;
        }
        while(n-->0){
            String str = scan.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            copy = amida[a];
            amida[a] = amida[b];
            amida[b] = copy;
        }
        for(int s: amida){
            System.out.println(s);
        }
    } main {
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt();//縦線の数
        int n = scan.nextInt();//横線の本数
        int[] amida = new int[w];
        int copy = 0;
        for(int i=0;i<amida.length;i++){
            amida[i] = i+1;
        }
        while(n-->0){
            String str = scan.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            copy = amida[a];
            amida[a] = amida[b];
            amida[b] = copy;
        }
        for(int s: amida){
            System.out.println(s);
        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] amida = new int[w]; amida new int[w] w int copy = 0; copy 0 for(int i=0;i<amida.length;i++){
            amida[i] = i+1;
        } int i=0; int i=0; i 0 i<amida.length i amida.length amida amida.length i++ i++ i {
            amida[i] = i+1;
        } {
            amida[i] = i+1;
        } amida[i] = i+1 amida[i] amida i i+1 i 1 while(n-->0){
            String str = scan.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            copy = amida[a];
            amida[a] = amida[b];
            amida[b] = copy;
        } n-->0 n-- n 0 {
            String str = scan.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            copy = amida[a];
            amida[a] = amida[b];
            amida[b] = copy;
        } String str = scan.next(); str scan.next() scan.next scan String[] ab = str.split(","); ab str.split(",") str.split str "," int a = Integer.parseInt(ab[0]) - 1; a Integer.parseInt(ab[0]) - 1 Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 1 int b = Integer.parseInt(ab[1]) - 1; b Integer.parseInt(ab[1]) - 1 Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 1 copy = amida[a] copy amida[a] amida a amida[a] = amida[b] amida[a] amida a amida[b] amida b amida[b] = copy amida[b] amida b copy for(int s: amida){
            System.out.println(s);
        } int s amida {
            System.out.println(s);
        } {
            System.out.println(s);
        } System.out.println(s) System.out.println System.out System System.out s String[] args args public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt();//縦線の数
        int n = scan.nextInt();//横線の本数
        int[] amida = new int[w];
        int copy = 0;
        for(int i=0;i<amida.length;i++){
            amida[i] = i+1;
        }
        while(n-->0){
            String str = scan.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            copy = amida[a];
            amida[a] = amida[b];
            amida[b] = copy;
        }
        for(int s: amida){
            System.out.println(s);
        }
    }

} public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt();//縦線の数
        int n = scan.nextInt();//横線の本数
        int[] amida = new int[w];
        int copy = 0;
        for(int i=0;i<amida.length;i++){
            amida[i] = i+1;
        }
        while(n-->0){
            String str = scan.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            copy = amida[a];
            amida[a] = amida[b];
            amida[b] = copy;
        }
        for(int s: amida){
            System.out.println(s);
        }
    }

} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt();//縦線の数
        int n = scan.nextInt();//横線の本数
        int[] amida = new int[w];
        int copy = 0;
        for(int i=0;i<amida.length;i++){
            amida[i] = i+1;
        }
        while(n-->0){
            String str = scan.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            copy = amida[a];
            amida[a] = amida[b];
            amida[b] = copy;
        }
        for(int s: amida){
            System.out.println(s);
        }
    }

}
