import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	
	int w = scan.nextInt(); // 縦線の数
	int[] narabi = new int[w]; // 現在の阿弥陀の数字の並び
	for (int i=0; i<w; i++)
	    narabi[i] = i+1;

	int n = scan.nextInt(); // 横線の数
        for (int i=0; i<n; i++) { // 交換
	    String[] str = scan.next().split(",",-1);
	    int a = Integer.parseInt(str[0])-1;
	    int b = Integer.parseInt(str[1])-1;
	    swap(narabi, a, b);
	}

	for (int i=0; i<w; i++)
	    System.out.println(narabi[i]);
	
    }

    private static void swap(int[] array, int n1, int n2) {
	int tmp = array[n1];
	array[n1] = array[n2];
	array[n2] = tmp;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	
	int w = scan.nextInt(); // 縦線の数
	int[] narabi = new int[w]; // 現在の阿弥陀の数字の並び
	for (int i=0; i<w; i++)
	    narabi[i] = i+1;

	int n = scan.nextInt(); // 横線の数
        for (int i=0; i<n; i++) { // 交換
	    String[] str = scan.next().split(",",-1);
	    int a = Integer.parseInt(str[0])-1;
	    int b = Integer.parseInt(str[1])-1;
	    swap(narabi, a, b);
	}

	for (int i=0; i<w; i++)
	    System.out.println(narabi[i]);
	
    }

    private static void swap(int[] array, int n1, int n2) {
	int tmp = array[n1];
	array[n1] = array[n2];
	array[n2] = tmp;
    }
} Main public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	
	int w = scan.nextInt(); // 縦線の数
	int[] narabi = new int[w]; // 現在の阿弥陀の数字の並び
	for (int i=0; i<w; i++)
	    narabi[i] = i+1;

	int n = scan.nextInt(); // 横線の数
        for (int i=0; i<n; i++) { // 交換
	    String[] str = scan.next().split(",",-1);
	    int a = Integer.parseInt(str[0])-1;
	    int b = Integer.parseInt(str[1])-1;
	    swap(narabi, a, b);
	}

	for (int i=0; i<w; i++)
	    System.out.println(narabi[i]);
	
    } main {
	Scanner scan = new Scanner(System.in);
	
	int w = scan.nextInt(); // 縦線の数
	int[] narabi = new int[w]; // 現在の阿弥陀の数字の並び
	for (int i=0; i<w; i++)
	    narabi[i] = i+1;

	int n = scan.nextInt(); // 横線の数
        for (int i=0; i<n; i++) { // 交換
	    String[] str = scan.next().split(",",-1);
	    int a = Integer.parseInt(str[0])-1;
	    int b = Integer.parseInt(str[1])-1;
	    swap(narabi, a, b);
	}

	for (int i=0; i<w; i++)
	    System.out.println(narabi[i]);
	
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan int[] narabi = new int[w]; narabi new int[w] w for (int i=0; i<w; i++)
	    narabi[i] = i+1; int i=0; int i=0; i 0 i<w i w i++ i++ i narabi[i] = i+1; narabi[i] = i+1 narabi[i] narabi i i+1 i 1 int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan for (int i=0; i<n; i++) { // 交換
	    String[] str = scan.next().split(",",-1);
	    int a = Integer.parseInt(str[0])-1;
	    int b = Integer.parseInt(str[1])-1;
	    swap(narabi, a, b);
	} int i=0; int i=0; i 0 i<n i n i++ i++ i { // 交換
	    String[] str = scan.next().split(",",-1);
	    int a = Integer.parseInt(str[0])-1;
	    int b = Integer.parseInt(str[1])-1;
	    swap(narabi, a, b);
	} { // 交換
	    String[] str = scan.next().split(",",-1);
	    int a = Integer.parseInt(str[0])-1;
	    int b = Integer.parseInt(str[1])-1;
	    swap(narabi, a, b);
	} String[] str = scan.next().split(",",-1); str scan.next().split(",",-1) scan.next().split scan.next() scan.next scan "," -1 1 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 swap(narabi, a, b) swap narabi a b for (int i=0; i<w; i++)
	    System.out.println(narabi[i]); int i=0; int i=0; i 0 i<w i w i++ i++ i System.out.println(narabi[i]); System.out.println(narabi[i]) System.out.println System.out System System.out narabi[i] narabi i String[] args args private static void swap(int[] array, int n1, int n2) {
	int tmp = array[n1];
	array[n1] = array[n2];
	array[n2] = tmp;
    } swap {
	int tmp = array[n1];
	array[n1] = array[n2];
	array[n2] = tmp;
    } int tmp = array[n1]; tmp array[n1] array n1 array[n1] = array[n2] array[n1] array n1 array[n2] array n2 array[n2] = tmp array[n2] array n2 tmp int[] array array int n1 n1 int n2 n2 public class Main {
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	
	int w = scan.nextInt(); // 縦線の数
	int[] narabi = new int[w]; // 現在の阿弥陀の数字の並び
	for (int i=0; i<w; i++)
	    narabi[i] = i+1;

	int n = scan.nextInt(); // 横線の数
        for (int i=0; i<n; i++) { // 交換
	    String[] str = scan.next().split(",",-1);
	    int a = Integer.parseInt(str[0])-1;
	    int b = Integer.parseInt(str[1])-1;
	    swap(narabi, a, b);
	}

	for (int i=0; i<w; i++)
	    System.out.println(narabi[i]);
	
    }

    private static void swap(int[] array, int n1, int n2) {
	int tmp = array[n1];
	array[n1] = array[n2];
	array[n2] = tmp;
    }
} public class Main {
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	
	int w = scan.nextInt(); // 縦線の数
	int[] narabi = new int[w]; // 現在の阿弥陀の数字の並び
	for (int i=0; i<w; i++)
	    narabi[i] = i+1;

	int n = scan.nextInt(); // 横線の数
        for (int i=0; i<n; i++) { // 交換
	    String[] str = scan.next().split(",",-1);
	    int a = Integer.parseInt(str[0])-1;
	    int b = Integer.parseInt(str[1])-1;
	    swap(narabi, a, b);
	}

	for (int i=0; i<w; i++)
	    System.out.println(narabi[i]);
	
    }

    private static void swap(int[] array, int n1, int n2) {
	int tmp = array[n1];
	array[n1] = array[n2];
	array[n2] = tmp;
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	
	int w = scan.nextInt(); // 縦線の数
	int[] narabi = new int[w]; // 現在の阿弥陀の数字の並び
	for (int i=0; i<w; i++)
	    narabi[i] = i+1;

	int n = scan.nextInt(); // 横線の数
        for (int i=0; i<n; i++) { // 交換
	    String[] str = scan.next().split(",",-1);
	    int a = Integer.parseInt(str[0])-1;
	    int b = Integer.parseInt(str[1])-1;
	    swap(narabi, a, b);
	}

	for (int i=0; i<w; i++)
	    System.out.println(narabi[i]);
	
    }

    private static void swap(int[] array, int n1, int n2) {
	int tmp = array[n1];
	array[n1] = array[n2];
	array[n2] = tmp;
    }
}