import java.util.*;

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

	while(sc.hasNext()){
	    int w = sc.nextInt();
	    int n = sc.nextInt();

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

	    while(0 < n--){
		String[] horizontal_line = sc.next().split(",");
		swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1);
	    }

	    for(int i = 0; i < w; ++i){
		System.out.println(String.valueOf(lots[i]));
	    }
	}
    }

    private static void swapVerticalLines(int[] lots, int line1, int line2){
	int tmp = lots[line1];
	lots[line1] = lots[line2];
	lots[line2] = tmp;
    }
} import java.util.*; util.* java public class Main
{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);

	while(sc.hasNext()){
	    int w = sc.nextInt();
	    int n = sc.nextInt();

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

	    while(0 < n--){
		String[] horizontal_line = sc.next().split(",");
		swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1);
	    }

	    for(int i = 0; i < w; ++i){
		System.out.println(String.valueOf(lots[i]));
	    }
	}
    }

    private static void swapVerticalLines(int[] lots, int line1, int line2){
	int tmp = lots[line1];
	lots[line1] = lots[line2];
	lots[line2] = tmp;
    }
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);

	while(sc.hasNext()){
	    int w = sc.nextInt();
	    int n = sc.nextInt();

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

	    while(0 < n--){
		String[] horizontal_line = sc.next().split(",");
		swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1);
	    }

	    for(int i = 0; i < w; ++i){
		System.out.println(String.valueOf(lots[i]));
	    }
	}
    } main {
	Scanner sc = new Scanner(System.in);

	while(sc.hasNext()){
	    int w = sc.nextInt();
	    int n = sc.nextInt();

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

	    while(0 < n--){
		String[] horizontal_line = sc.next().split(",");
		swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1);
	    }

	    for(int i = 0; i < w; ++i){
		System.out.println(String.valueOf(lots[i]));
	    }
	}
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) while(sc.hasNext()){
	    int w = sc.nextInt();
	    int n = sc.nextInt();

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

	    while(0 < n--){
		String[] horizontal_line = sc.next().split(",");
		swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1);
	    }

	    for(int i = 0; i < w; ++i){
		System.out.println(String.valueOf(lots[i]));
	    }
	} sc.hasNext() sc.hasNext sc {
	    int w = sc.nextInt();
	    int n = sc.nextInt();

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

	    while(0 < n--){
		String[] horizontal_line = sc.next().split(",");
		swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1);
	    }

	    for(int i = 0; i < w; ++i){
		System.out.println(String.valueOf(lots[i]));
	    }
	} int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] lots = new int[w]; lots new int[w] w for(int i = 1; i <= w; ++i){
		lots[i-1] = i;
	    } int i = 1; int i = 1; i 1 i <= w i w ++i ++i i {
		lots[i-1] = i;
	    } {
		lots[i-1] = i;
	    } lots[i-1] = i lots[i-1] lots i-1 i 1 i while(0 < n--){
		String[] horizontal_line = sc.next().split(",");
		swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1);
	    } 0 < n-- 0 n-- n {
		String[] horizontal_line = sc.next().split(",");
		swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1);
	    } String[] horizontal_line = sc.next().split(","); horizontal_line sc.next().split(",") sc.next().split sc.next() sc.next sc "," swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1) swapVerticalLines lots Integer.parseInt(horizontal_line[0])-1 Integer.parseInt(horizontal_line[0]) Integer.parseInt Integer horizontal_line[0] horizontal_line 0 1 Integer.parseInt(horizontal_line[1])-1 Integer.parseInt(horizontal_line[1]) Integer.parseInt Integer horizontal_line[1] horizontal_line 1 1 for(int i = 0; i < w; ++i){
		System.out.println(String.valueOf(lots[i]));
	    } int i = 0; int i = 0; i 0 i < w i w ++i ++i i {
		System.out.println(String.valueOf(lots[i]));
	    } {
		System.out.println(String.valueOf(lots[i]));
	    } System.out.println(String.valueOf(lots[i])) System.out.println System.out System System.out String.valueOf(lots[i]) String.valueOf String lots[i] lots i String[] args args private static void swapVerticalLines(int[] lots, int line1, int line2){
	int tmp = lots[line1];
	lots[line1] = lots[line2];
	lots[line2] = tmp;
    } swapVerticalLines {
	int tmp = lots[line1];
	lots[line1] = lots[line2];
	lots[line2] = tmp;
    } int tmp = lots[line1]; tmp lots[line1] lots line1 lots[line1] = lots[line2] lots[line1] lots line1 lots[line2] lots line2 lots[line2] = tmp lots[line2] lots line2 tmp int[] lots lots int line1 line1 int line2 line2 public class Main
{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);

	while(sc.hasNext()){
	    int w = sc.nextInt();
	    int n = sc.nextInt();

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

	    while(0 < n--){
		String[] horizontal_line = sc.next().split(",");
		swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1);
	    }

	    for(int i = 0; i < w; ++i){
		System.out.println(String.valueOf(lots[i]));
	    }
	}
    }

    private static void swapVerticalLines(int[] lots, int line1, int line2){
	int tmp = lots[line1];
	lots[line1] = lots[line2];
	lots[line2] = tmp;
    }
} public class Main
{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);

	while(sc.hasNext()){
	    int w = sc.nextInt();
	    int n = sc.nextInt();

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

	    while(0 < n--){
		String[] horizontal_line = sc.next().split(",");
		swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1);
	    }

	    for(int i = 0; i < w; ++i){
		System.out.println(String.valueOf(lots[i]));
	    }
	}
    }

    private static void swapVerticalLines(int[] lots, int line1, int line2){
	int tmp = lots[line1];
	lots[line1] = lots[line2];
	lots[line2] = tmp;
    }
} Main
import java.util.*;

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

	while(sc.hasNext()){
	    int w = sc.nextInt();
	    int n = sc.nextInt();

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

	    while(0 < n--){
		String[] horizontal_line = sc.next().split(",");
		swapVerticalLines(lots, Integer.parseInt(horizontal_line[0])-1, Integer.parseInt(horizontal_line[1])-1);
	    }

	    for(int i = 0; i < w; ++i){
		System.out.println(String.valueOf(lots[i]));
	    }
	}
    }

    private static void swapVerticalLines(int[] lots, int line1, int line2){
	int tmp = lots[line1];
	lots[line1] = lots[line2];
	lots[line2] = tmp;
    }
}