import java.util.Scanner;

public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int a,b,c;
        int[] t = new int[w];
        for(int i=0;i<w;i++){
            t[i]=i+1;
        }
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] suuti = s.split(",");
            a = Integer.parseInt(suuti[0])-1;
            b = Integer.parseInt(suuti[1])-1;
            c = t[a];
            t[a] = t[b];
            t[b] = c;
        }
        for(int i=0;i<w;i++){
            System.out.println(t[i]);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int a,b,c;
        int[] t = new int[w];
        for(int i=0;i<w;i++){
            t[i]=i+1;
        }
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] suuti = s.split(",");
            a = Integer.parseInt(suuti[0])-1;
            b = Integer.parseInt(suuti[1])-1;
            c = t[a];
            t[a] = t[b];
            t[b] = c;
        }
        for(int i=0;i<w;i++){
            System.out.println(t[i]);
        }
    }
} Main public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int a,b,c;
        int[] t = new int[w];
        for(int i=0;i<w;i++){
            t[i]=i+1;
        }
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] suuti = s.split(",");
            a = Integer.parseInt(suuti[0])-1;
            b = Integer.parseInt(suuti[1])-1;
            c = t[a];
            t[a] = t[b];
            t[b] = c;
        }
        for(int i=0;i<w;i++){
            System.out.println(t[i]);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int a,b,c;
        int[] t = new int[w];
        for(int i=0;i<w;i++){
            t[i]=i+1;
        }
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] suuti = s.split(",");
            a = Integer.parseInt(suuti[0])-1;
            b = Integer.parseInt(suuti[1])-1;
            c = t[a];
            t[a] = t[b];
            t[b] = c;
        }
        for(int i=0;i<w;i++){
            System.out.println(t[i]);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int a a b b c; c int[] t = new int[w]; t new int[w] w for(int i=0;i<w;i++){
            t[i]=i+1;
        } int i=0; int i=0; i 0 i<w i w i++ i++ i {
            t[i]=i+1;
        } {
            t[i]=i+1;
        } t[i]=i+1 t[i] t i i+1 i 1 for(int i=0;i<n;i++){
            String s = sc.next();
            String[] suuti = s.split(",");
            a = Integer.parseInt(suuti[0])-1;
            b = Integer.parseInt(suuti[1])-1;
            c = t[a];
            t[a] = t[b];
            t[b] = c;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            String s = sc.next();
            String[] suuti = s.split(",");
            a = Integer.parseInt(suuti[0])-1;
            b = Integer.parseInt(suuti[1])-1;
            c = t[a];
            t[a] = t[b];
            t[b] = c;
        } {
            String s = sc.next();
            String[] suuti = s.split(",");
            a = Integer.parseInt(suuti[0])-1;
            b = Integer.parseInt(suuti[1])-1;
            c = t[a];
            t[a] = t[b];
            t[b] = c;
        } String s = sc.next(); s sc.next() sc.next sc String[] suuti = s.split(","); suuti s.split(",") s.split s "," a = Integer.parseInt(suuti[0])-1 a Integer.parseInt(suuti[0])-1 Integer.parseInt(suuti[0]) Integer.parseInt Integer suuti[0] suuti 0 1 b = Integer.parseInt(suuti[1])-1 b Integer.parseInt(suuti[1])-1 Integer.parseInt(suuti[1]) Integer.parseInt Integer suuti[1] suuti 1 1 c = t[a] c t[a] t a t[a] = t[b] t[a] t a t[b] t b t[b] = c t[b] t b c for(int i=0;i<w;i++){
            System.out.println(t[i]);
        } int i=0; int i=0; i 0 i<w i w i++ i++ i {
            System.out.println(t[i]);
        } {
            System.out.println(t[i]);
        } System.out.println(t[i]) System.out.println System.out System System.out t[i] t i String[]argc argc public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int a,b,c;
        int[] t = new int[w];
        for(int i=0;i<w;i++){
            t[i]=i+1;
        }
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] suuti = s.split(",");
            a = Integer.parseInt(suuti[0])-1;
            b = Integer.parseInt(suuti[1])-1;
            c = t[a];
            t[a] = t[b];
            t[b] = c;
        }
        for(int i=0;i<w;i++){
            System.out.println(t[i]);
        }
    }
} public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int a,b,c;
        int[] t = new int[w];
        for(int i=0;i<w;i++){
            t[i]=i+1;
        }
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] suuti = s.split(",");
            a = Integer.parseInt(suuti[0])-1;
            b = Integer.parseInt(suuti[1])-1;
            c = t[a];
            t[a] = t[b];
            t[b] = c;
        }
        for(int i=0;i<w;i++){
            System.out.println(t[i]);
        }
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int a,b,c;
        int[] t = new int[w];
        for(int i=0;i<w;i++){
            t[i]=i+1;
        }
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] suuti = s.split(",");
            a = Integer.parseInt(suuti[0])-1;
            b = Integer.parseInt(suuti[1])-1;
            c = t[a];
            t[a] = t[b];
            t[b] = c;
        }
        for(int i=0;i<w;i++){
            System.out.println(t[i]);
        }
    }
}
