import java.util.*;

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

        for(int i: a){
            System.out.println(i);
        }
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int w = in.nextInt();
        int n = in.nextInt(); in.nextLine();
        int[] a = new int[w];
        for(int i = 0; i < w; i++){
            a[i] = i + 1;
        }
        for(int i = 0; i < n; i++){
            String[] line = in.nextLine().split(",");
            int s = Integer.parseInt(line[0]) - 1;
            int t = Integer.parseInt(line[1]) - 1;
            int tmp = a[s]; a[s] = a[t]; a[t] = tmp;
        }

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

        for(int i: a){
            System.out.println(i);
        }
    } main {
        Scanner in = new Scanner(System.in);
        int w = in.nextInt();
        int n = in.nextInt(); in.nextLine();
        int[] a = new int[w];
        for(int i = 0; i < w; i++){
            a[i] = i + 1;
        }
        for(int i = 0; i < n; i++){
            String[] line = in.nextLine().split(",");
            int s = Integer.parseInt(line[0]) - 1;
            int t = Integer.parseInt(line[1]) - 1;
            int tmp = a[s]; a[s] = a[t]; a[t] = tmp;
        }

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

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

        for(int i: a){
            System.out.println(i);
        }
    }
} Main
import java.util.*;

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

        for(int i: a){
            System.out.println(i);
        }
    }
}