import java.io.*;
import java.util.*;

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

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