import java.util.*;

class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);

	int w = sc.nextInt();
	int n = sc.nextInt();

	int[][] change = new int[n][2];
	for(int i=0; i<n; i++){
	    String[] s = (sc.next()).split(",");
	    change[i][0] = Integer.parseInt(s[0]);
	    change[i][1] = Integer.parseInt(s[1]);
	}

	int[] num = new int[w+1];
	for(int i=1; i<=w; i++){
	    num[i] = i;
	}

	for(int i=0; i<n; i++){
	    int temp = num[change[i][0]];
	    num[change[i][0]] = num[change[i][1]];
	    num[change[i][1]] = temp;
	}

	for(int i=1; i<=w; i++){
	    System.out.println(num[i]);
	}
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);

	int w = sc.nextInt();
	int n = sc.nextInt();

	int[][] change = new int[n][2];
	for(int i=0; i<n; i++){
	    String[] s = (sc.next()).split(",");
	    change[i][0] = Integer.parseInt(s[0]);
	    change[i][1] = Integer.parseInt(s[1]);
	}

	int[] num = new int[w+1];
	for(int i=1; i<=w; i++){
	    num[i] = i;
	}

	for(int i=0; i<n; i++){
	    int temp = num[change[i][0]];
	    num[change[i][0]] = num[change[i][1]];
	    num[change[i][1]] = temp;
	}

	for(int i=1; i<=w; i++){
	    System.out.println(num[i]);
	}
    }
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);

	int w = sc.nextInt();
	int n = sc.nextInt();

	int[][] change = new int[n][2];
	for(int i=0; i<n; i++){
	    String[] s = (sc.next()).split(",");
	    change[i][0] = Integer.parseInt(s[0]);
	    change[i][1] = Integer.parseInt(s[1]);
	}

	int[] num = new int[w+1];
	for(int i=1; i<=w; i++){
	    num[i] = i;
	}

	for(int i=0; i<n; i++){
	    int temp = num[change[i][0]];
	    num[change[i][0]] = num[change[i][1]];
	    num[change[i][1]] = temp;
	}

	for(int i=1; i<=w; i++){
	    System.out.println(num[i]);
	}
    } main {
	Scanner sc = new Scanner(System.in);

	int w = sc.nextInt();
	int n = sc.nextInt();

	int[][] change = new int[n][2];
	for(int i=0; i<n; i++){
	    String[] s = (sc.next()).split(",");
	    change[i][0] = Integer.parseInt(s[0]);
	    change[i][1] = Integer.parseInt(s[1]);
	}

	int[] num = new int[w+1];
	for(int i=1; i<=w; i++){
	    num[i] = i;
	}

	for(int i=0; i<n; i++){
	    int temp = num[change[i][0]];
	    num[change[i][0]] = num[change[i][1]];
	    num[change[i][1]] = temp;
	}

	for(int i=1; i<=w; i++){
	    System.out.println(num[i]);
	}
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[][] change = new int[n][2]; change new int[n][2] n 2 for(int i=0; i<n; i++){
	    String[] s = (sc.next()).split(",");
	    change[i][0] = Integer.parseInt(s[0]);
	    change[i][1] = Integer.parseInt(s[1]);
	} int i=0; int i=0; i 0 i<n i n i++ i++ i {
	    String[] s = (sc.next()).split(",");
	    change[i][0] = Integer.parseInt(s[0]);
	    change[i][1] = Integer.parseInt(s[1]);
	} {
	    String[] s = (sc.next()).split(",");
	    change[i][0] = Integer.parseInt(s[0]);
	    change[i][1] = Integer.parseInt(s[1]);
	} String[] s = (sc.next()).split(","); s (sc.next()).split(",") (sc.next()).split (sc.next()) sc.next sc "," change[i][0] = Integer.parseInt(s[0]) change[i][0] change[i] change i 0 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 change[i][1] = Integer.parseInt(s[1]) change[i][1] change[i] change i 1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 int[] num = new int[w+1]; num new int[w+1] w+1 w 1 for(int i=1; i<=w; i++){
	    num[i] = i;
	} int i=1; int i=1; i 1 i<=w i w i++ i++ i {
	    num[i] = i;
	} {
	    num[i] = i;
	} num[i] = i num[i] num i i for(int i=0; i<n; i++){
	    int temp = num[change[i][0]];
	    num[change[i][0]] = num[change[i][1]];
	    num[change[i][1]] = temp;
	} int i=0; int i=0; i 0 i<n i n i++ i++ i {
	    int temp = num[change[i][0]];
	    num[change[i][0]] = num[change[i][1]];
	    num[change[i][1]] = temp;
	} {
	    int temp = num[change[i][0]];
	    num[change[i][0]] = num[change[i][1]];
	    num[change[i][1]] = temp;
	} int temp = num[change[i][0]]; temp num[change[i][0]] num change[i][0] change[i] change i 0 num[change[i][0]] = num[change[i][1]] num[change[i][0]] num change[i][0] change[i] change i 0 num[change[i][1]] num change[i][1] change[i] change i 1 num[change[i][1]] = temp num[change[i][1]] num change[i][1] change[i] change i 1 temp for(int i=1; i<=w; i++){
	    System.out.println(num[i]);
	} int i=1; int i=1; i 1 i<=w i w i++ i++ i {
	    System.out.println(num[i]);
	} {
	    System.out.println(num[i]);
	} System.out.println(num[i]) System.out.println System.out System System.out num[i] num i String[] args args
import java.util.*;

class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);

	int w = sc.nextInt();
	int n = sc.nextInt();

	int[][] change = new int[n][2];
	for(int i=0; i<n; i++){
	    String[] s = (sc.next()).split(",");
	    change[i][0] = Integer.parseInt(s[0]);
	    change[i][1] = Integer.parseInt(s[1]);
	}

	int[] num = new int[w+1];
	for(int i=1; i<=w; i++){
	    num[i] = i;
	}

	for(int i=0; i<n; i++){
	    int temp = num[change[i][0]];
	    num[change[i][0]] = num[change[i][1]];
	    num[change[i][1]] = temp;
	}

	for(int i=1; i<=w; i++){
	    System.out.println(num[i]);
	}
    }
}