import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int box[] = new int[30];
        int x=0;       
        int w  = sc.nextInt();
        int n  = sc.nextInt();
        
        for(int i=0;i<w;i++){
            box[i] = i + 1;
        }

        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",",0);

            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            x = box[a];
            box[a] = box[b];
            box[b] = x;
        }

        for(int i=0;i<w;i++){
            System.out.println(box[i]);
        }

        sc.close();
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int box[] = new int[30];
        int x=0;       
        int w  = sc.nextInt();
        int n  = sc.nextInt();
        
        for(int i=0;i<w;i++){
            box[i] = i + 1;
        }

        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",",0);

            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            x = box[a];
            box[a] = box[b];
            box[b] = x;
        }

        for(int i=0;i<w;i++){
            System.out.println(box[i]);
        }

        sc.close();
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int box[] = new int[30];
        int x=0;       
        int w  = sc.nextInt();
        int n  = sc.nextInt();
        
        for(int i=0;i<w;i++){
            box[i] = i + 1;
        }

        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",",0);

            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            x = box[a];
            box[a] = box[b];
            box[b] = x;
        }

        for(int i=0;i<w;i++){
            System.out.println(box[i]);
        }

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        int box[] = new int[30];
        int x=0;       
        int w  = sc.nextInt();
        int n  = sc.nextInt();
        
        for(int i=0;i<w;i++){
            box[i] = i + 1;
        }

        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",",0);

            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            x = box[a];
            box[a] = box[b];
            box[b] = x;
        }

        for(int i=0;i<w;i++){
            System.out.println(box[i]);
        }

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int box[] = new int[30]; box new int[30] 30 int x=0; x 0 int w  = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n  = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i=0;i<w;i++){
            box[i] = i + 1;
        } int i=0; int i=0; i 0 i<w i w i++ i++ i {
            box[i] = i + 1;
        } {
            box[i] = i + 1;
        } box[i] = i + 1 box[i] box i i + 1 i 1 for(int i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",",0);

            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            x = box[a];
            box[a] = box[b];
            box[b] = x;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            String str = sc.next();
            String[] ab = str.split(",",0);

            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            x = box[a];
            box[a] = box[b];
            box[b] = x;
        } {
            String str = sc.next();
            String[] ab = str.split(",",0);

            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            x = box[a];
            box[a] = box[b];
            box[b] = x;
        } String str = sc.next(); str sc.next() sc.next sc String[] ab = str.split(",",0); ab str.split(",",0) str.split str "," 0 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 x = box[a] x box[a] box a box[a] = box[b] box[a] box a box[b] box b box[b] = x box[b] box b x for(int i=0;i<w;i++){
            System.out.println(box[i]);
        } int i=0; int i=0; i 0 i<w i w i++ i++ i {
            System.out.println(box[i]);
        } {
            System.out.println(box[i]);
        } System.out.println(box[i]) System.out.println System.out System System.out box[i] box i sc.close() sc.close sc String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int box[] = new int[30];
        int x=0;       
        int w  = sc.nextInt();
        int n  = sc.nextInt();
        
        for(int i=0;i<w;i++){
            box[i] = i + 1;
        }

        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",",0);

            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            x = box[a];
            box[a] = box[b];
            box[b] = x;
        }

        for(int i=0;i<w;i++){
            System.out.println(box[i]);
        }

        sc.close();
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int box[] = new int[30];
        int x=0;       
        int w  = sc.nextInt();
        int n  = sc.nextInt();
        
        for(int i=0;i<w;i++){
            box[i] = i + 1;
        }

        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",",0);

            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            x = box[a];
            box[a] = box[b];
            box[b] = x;
        }

        for(int i=0;i<w;i++){
            System.out.println(box[i]);
        }

        sc.close();
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int box[] = new int[30];
        int x=0;       
        int w  = sc.nextInt();
        int n  = sc.nextInt();
        
        for(int i=0;i<w;i++){
            box[i] = i + 1;
        }

        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",",0);

            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            x = box[a];
            box[a] = box[b];
            box[b] = x;
        }

        for(int i=0;i<w;i++){
            System.out.println(box[i]);
        }

        sc.close();
    }
}
