import java.util.Scanner;

public class Main {
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        int z = sc.nextInt();
        int[] w = new int[z];
        for(int i = 0; i < z; i++){
            w[i] = i+1;
        }
        int n = sc.nextInt();
        for(int j = 0; j<n; j++){
            String s = sc.next();
            String[] ab = s.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int c = w[a];
            w[a] = w[b];
            w[b] = c;
        }
        for(int k = 0; k < z; k++){
            System.out.println(w[k]);
        }
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        int z = sc.nextInt();
        int[] w = new int[z];
        for(int i = 0; i < z; i++){
            w[i] = i+1;
        }
        int n = sc.nextInt();
        for(int j = 0; j<n; j++){
            String s = sc.next();
            String[] ab = s.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int c = w[a];
            w[a] = w[b];
            w[b] = c;
        }
        for(int k = 0; k < z; k++){
            System.out.println(w[k]);
        }
        sc.close();
    }
} Main public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        int z = sc.nextInt();
        int[] w = new int[z];
        for(int i = 0; i < z; i++){
            w[i] = i+1;
        }
        int n = sc.nextInt();
        for(int j = 0; j<n; j++){
            String s = sc.next();
            String[] ab = s.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int c = w[a];
            w[a] = w[b];
            w[b] = c;
        }
        for(int k = 0; k < z; k++){
            System.out.println(w[k]);
        }
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int z = sc.nextInt();
        int[] w = new int[z];
        for(int i = 0; i < z; i++){
            w[i] = i+1;
        }
        int n = sc.nextInt();
        for(int j = 0; j<n; j++){
            String s = sc.next();
            String[] ab = s.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int c = w[a];
            w[a] = w[b];
            w[b] = c;
        }
        for(int k = 0; k < z; k++){
            System.out.println(w[k]);
        }
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int z = sc.nextInt(); z sc.nextInt() sc.nextInt sc int[] w = new int[z]; w new int[z] z for(int i = 0; i < z; i++){
            w[i] = i+1;
        } int i = 0; int i = 0; i 0 i < z i z i++ i++ i {
            w[i] = i+1;
        } {
            w[i] = i+1;
        } w[i] = i+1 w[i] w i i+1 i 1 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int j = 0; j<n; j++){
            String s = sc.next();
            String[] ab = s.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int c = w[a];
            w[a] = w[b];
            w[b] = c;
        } int j = 0; int j = 0; j 0 j<n j n j++ j++ j {
            String s = sc.next();
            String[] ab = s.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int c = w[a];
            w[a] = w[b];
            w[b] = c;
        } {
            String s = sc.next();
            String[] ab = s.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int c = w[a];
            w[a] = w[b];
            w[b] = c;
        } String s = sc.next(); s sc.next() sc.next sc String[] ab = s.split(","); ab s.split(",") s.split s "," int a = Integer.parseInt(ab[0])-1; a Integer.parseInt(ab[0])-1 Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 1 int b = Integer.parseInt(ab[1])-1; b Integer.parseInt(ab[1])-1 Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 1 int c = w[a]; c w[a] w a w[a] = w[b] w[a] w a w[b] w b w[b] = c w[b] w b c for(int k = 0; k < z; k++){
            System.out.println(w[k]);
        } int k = 0; int k = 0; k 0 k < z k z k++ k++ k {
            System.out.println(w[k]);
        } {
            System.out.println(w[k]);
        } System.out.println(w[k]) System.out.println System.out System System.out w[k] w k sc.close() sc.close sc String[] arg arg public class Main {
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        int z = sc.nextInt();
        int[] w = new int[z];
        for(int i = 0; i < z; i++){
            w[i] = i+1;
        }
        int n = sc.nextInt();
        for(int j = 0; j<n; j++){
            String s = sc.next();
            String[] ab = s.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int c = w[a];
            w[a] = w[b];
            w[b] = c;
        }
        for(int k = 0; k < z; k++){
            System.out.println(w[k]);
        }
        sc.close();
    }
} public class Main {
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        int z = sc.nextInt();
        int[] w = new int[z];
        for(int i = 0; i < z; i++){
            w[i] = i+1;
        }
        int n = sc.nextInt();
        for(int j = 0; j<n; j++){
            String s = sc.next();
            String[] ab = s.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int c = w[a];
            w[a] = w[b];
            w[b] = c;
        }
        for(int k = 0; k < z; k++){
            System.out.println(w[k]);
        }
        sc.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        int z = sc.nextInt();
        int[] w = new int[z];
        for(int i = 0; i < z; i++){
            w[i] = i+1;
        }
        int n = sc.nextInt();
        for(int j = 0; j<n; j++){
            String s = sc.next();
            String[] ab = s.split(",");
            int a = Integer.parseInt(ab[0])-1;
            int b = Integer.parseInt(ab[1])-1;
            int c = w[a];
            w[a] = w[b];
            w[b] = c;
        }
        for(int k = 0; k < z; k++){
            System.out.println(w[k]);
        }
        sc.close();
    }
}
