import java.util.Scanner;

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

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