import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num = new int[w+1];
        sc.nextLine();
        for(int i=1; i<=w; i++){
            num[i] = i;
        }
        for(int i=0; i<n; i++){
            String[] line = sc.nextLine().split(",",0);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            int tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }
        for(int i=1; i<=w; i++){
            System.out.println(num[i]);
        }
    }
}

 import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num = new int[w+1];
        sc.nextLine();
        for(int i=1; i<=w; i++){
            num[i] = i;
        }
        for(int i=0; i<n; i++){
            String[] line = sc.nextLine().split(",",0);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            int tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }
        for(int i=1; i<=w; i++){
            System.out.println(num[i]);
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num = new int[w+1];
        sc.nextLine();
        for(int i=1; i<=w; i++){
            num[i] = i;
        }
        for(int i=0; i<n; i++){
            String[] line = sc.nextLine().split(",",0);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            int tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }
        for(int i=1; i<=w; i++){
            System.out.println(num[i]);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num = new int[w+1];
        sc.nextLine();
        for(int i=1; i<=w; i++){
            num[i] = i;
        }
        for(int i=0; i<n; i++){
            String[] line = sc.nextLine().split(",",0);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            int tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }
        for(int i=1; i<=w; i++){
            System.out.println(num[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[] num = new int[w+1]; num new int[w+1] w+1 w 1 sc.nextLine() sc.nextLine sc for(int i=1; i<=w; i++){
            num[i] = i;
        } int i=1; int i=1; i 1 i<=w i w i++ i++ i {
            num[i] = i;
        } {
            num[i] = i;
        } num[i] = i num[i] num i i for(int i=0; i<n; i++){
            String[] line = sc.nextLine().split(",",0);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            int tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            String[] line = sc.nextLine().split(",",0);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            int tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        } {
            String[] line = sc.nextLine().split(",",0);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            int tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        } String[] line = sc.nextLine().split(",",0); line sc.nextLine().split(",",0) sc.nextLine().split sc.nextLine() sc.nextLine sc "," 0 int a = Integer.parseInt(line[0]); a Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int b = Integer.parseInt(line[1]); b Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 int tmp = num[a]; tmp num[a] num a num[a] = num[b] num[a] num a num[b] num b num[b] = tmp num[b] num b tmp for(int i=1; i<=w; i++){
            System.out.println(num[i]);
        } int i=1; int i=1; i 1 i<=w i w i++ i++ i {
            System.out.println(num[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 public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num = new int[w+1];
        sc.nextLine();
        for(int i=1; i<=w; i++){
            num[i] = i;
        }
        for(int i=0; i<n; i++){
            String[] line = sc.nextLine().split(",",0);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            int tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }
        for(int i=1; i<=w; i++){
            System.out.println(num[i]);
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num = new int[w+1];
        sc.nextLine();
        for(int i=1; i<=w; i++){
            num[i] = i;
        }
        for(int i=0; i<n; i++){
            String[] line = sc.nextLine().split(",",0);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            int tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }
        for(int i=1; i<=w; i++){
            System.out.println(num[i]);
        }
    }
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num = new int[w+1];
        sc.nextLine();
        for(int i=1; i<=w; i++){
            num[i] = i;
        }
        for(int i=0; i<n; i++){
            String[] line = sc.nextLine().split(",",0);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            int tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }
        for(int i=1; i<=w; i++){
            System.out.println(num[i]);
        }
    }
}


