import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w1 = sc.nextInt();
        int[] w2 = new int[w1];
        for(int i=0;i<w1;i++){
            w2[i] = i+1;
        }
        int n = sc.nextInt();
        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] str2 = str.split(",");
            int a = Integer.parseInt(str2[0])-1;
            int b = Integer.parseInt(str2[1])-1;
            int tmp;
            tmp = w2[a];
            w2[a] = w2[b];
            w2[b] = tmp;
        }
        for(int i=0;i<w1;i++){
            System.out.println(w2[i]);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w1 = sc.nextInt();
        int[] w2 = new int[w1];
        for(int i=0;i<w1;i++){
            w2[i] = i+1;
        }
        int n = sc.nextInt();
        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] str2 = str.split(",");
            int a = Integer.parseInt(str2[0])-1;
            int b = Integer.parseInt(str2[1])-1;
            int tmp;
            tmp = w2[a];
            w2[a] = w2[b];
            w2[b] = tmp;
        }
        for(int i=0;i<w1;i++){
            System.out.println(w2[i]);
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w1 = sc.nextInt();
        int[] w2 = new int[w1];
        for(int i=0;i<w1;i++){
            w2[i] = i+1;
        }
        int n = sc.nextInt();
        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] str2 = str.split(",");
            int a = Integer.parseInt(str2[0])-1;
            int b = Integer.parseInt(str2[1])-1;
            int tmp;
            tmp = w2[a];
            w2[a] = w2[b];
            w2[b] = tmp;
        }
        for(int i=0;i<w1;i++){
            System.out.println(w2[i]);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int w1 = sc.nextInt();
        int[] w2 = new int[w1];
        for(int i=0;i<w1;i++){
            w2[i] = i+1;
        }
        int n = sc.nextInt();
        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] str2 = str.split(",");
            int a = Integer.parseInt(str2[0])-1;
            int b = Integer.parseInt(str2[1])-1;
            int tmp;
            tmp = w2[a];
            w2[a] = w2[b];
            w2[b] = tmp;
        }
        for(int i=0;i<w1;i++){
            System.out.println(w2[i]);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w1 = sc.nextInt(); w1 sc.nextInt() sc.nextInt sc int[] w2 = new int[w1]; w2 new int[w1] w1 for(int i=0;i<w1;i++){
            w2[i] = i+1;
        } int i=0; int i=0; i 0 i<w1 i w1 i++ i++ i {
            w2[i] = i+1;
        } {
            w2[i] = i+1;
        } w2[i] = i+1 w2[i] w2 i i+1 i 1 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i=0;i<n;i++){
            String str = sc.next();
            String[] str2 = str.split(",");
            int a = Integer.parseInt(str2[0])-1;
            int b = Integer.parseInt(str2[1])-1;
            int tmp;
            tmp = w2[a];
            w2[a] = w2[b];
            w2[b] = tmp;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            String str = sc.next();
            String[] str2 = str.split(",");
            int a = Integer.parseInt(str2[0])-1;
            int b = Integer.parseInt(str2[1])-1;
            int tmp;
            tmp = w2[a];
            w2[a] = w2[b];
            w2[b] = tmp;
        } {
            String str = sc.next();
            String[] str2 = str.split(",");
            int a = Integer.parseInt(str2[0])-1;
            int b = Integer.parseInt(str2[1])-1;
            int tmp;
            tmp = w2[a];
            w2[a] = w2[b];
            w2[b] = tmp;
        } String str = sc.next(); str sc.next() sc.next sc String[] str2 = str.split(","); str2 str.split(",") str.split str "," int a = Integer.parseInt(str2[0])-1; a Integer.parseInt(str2[0])-1 Integer.parseInt(str2[0]) Integer.parseInt Integer str2[0] str2 0 1 int b = Integer.parseInt(str2[1])-1; b Integer.parseInt(str2[1])-1 Integer.parseInt(str2[1]) Integer.parseInt Integer str2[1] str2 1 1 int tmp; tmp tmp = w2[a] tmp w2[a] w2 a w2[a] = w2[b] w2[a] w2 a w2[b] w2 b w2[b] = tmp w2[b] w2 b tmp for(int i=0;i<w1;i++){
            System.out.println(w2[i]);
        } int i=0; int i=0; i 0 i<w1 i w1 i++ i++ i {
            System.out.println(w2[i]);
        } {
            System.out.println(w2[i]);
        } System.out.println(w2[i]) System.out.println System.out System System.out w2[i] w2 i String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w1 = sc.nextInt();
        int[] w2 = new int[w1];
        for(int i=0;i<w1;i++){
            w2[i] = i+1;
        }
        int n = sc.nextInt();
        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] str2 = str.split(",");
            int a = Integer.parseInt(str2[0])-1;
            int b = Integer.parseInt(str2[1])-1;
            int tmp;
            tmp = w2[a];
            w2[a] = w2[b];
            w2[b] = tmp;
        }
        for(int i=0;i<w1;i++){
            System.out.println(w2[i]);
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w1 = sc.nextInt();
        int[] w2 = new int[w1];
        for(int i=0;i<w1;i++){
            w2[i] = i+1;
        }
        int n = sc.nextInt();
        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] str2 = str.split(",");
            int a = Integer.parseInt(str2[0])-1;
            int b = Integer.parseInt(str2[1])-1;
            int tmp;
            tmp = w2[a];
            w2[a] = w2[b];
            w2[b] = tmp;
        }
        for(int i=0;i<w1;i++){
            System.out.println(w2[i]);
        }
    }
} Main
import java.util.Scanner;

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