import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{

    public static final int FIRST_NUMBER = 0;
    public static final int SECOND_NUMBER = 1;

    public static void main(String[] args) {

	Scanner sc = new Scanner(System.in);
	// ?¨??????\?????¨????????????????£?
	int arrayLength = Integer.parseInt(sc.nextLine());
	int loopCount = Integer.parseInt(sc.nextLine());

	// ?????\???????????????
	int[] outputArray = new int[arrayLength + 1];
	for (int i = 0; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	// ??\????????????
	List<int[]> inputArrays = new ArrayList<>();

	for (int i = 0; i < loopCount; i++) {
	    String[] queryStr = sc.nextLine().split(",");
	    int[] query = new int[2];
	    query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]);
	    query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]);
	    inputArrays.add(query);
	}

	// lots???draw?????????????????????outputArray???????´???????
	exchangeLine(inputArrays, outputArray);

	// ?????????????????????
	for (int i = 1; i < outputArray.length; i++) {
	    System.out.println(outputArray[i]);
	}

    }

    private static void exchangeLine(List<int[]> inputArrays, int[] outputArray) {

	for (int[] query : inputArrays) {
	    int mediator = 0;

	    mediator = outputArray[query[FIRST_NUMBER]];
	    outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]];
	    outputArray[query[SECOND_NUMBER]] = mediator;

	}

    }
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main{

    public static final int FIRST_NUMBER = 0;
    public static final int SECOND_NUMBER = 1;

    public static void main(String[] args) {

	Scanner sc = new Scanner(System.in);
	// ?¨??????\?????¨????????????????£?
	int arrayLength = Integer.parseInt(sc.nextLine());
	int loopCount = Integer.parseInt(sc.nextLine());

	// ?????\???????????????
	int[] outputArray = new int[arrayLength + 1];
	for (int i = 0; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	// ??\????????????
	List<int[]> inputArrays = new ArrayList<>();

	for (int i = 0; i < loopCount; i++) {
	    String[] queryStr = sc.nextLine().split(",");
	    int[] query = new int[2];
	    query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]);
	    query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]);
	    inputArrays.add(query);
	}

	// lots???draw?????????????????????outputArray???????´???????
	exchangeLine(inputArrays, outputArray);

	// ?????????????????????
	for (int i = 1; i < outputArray.length; i++) {
	    System.out.println(outputArray[i]);
	}

    }

    private static void exchangeLine(List<int[]> inputArrays, int[] outputArray) {

	for (int[] query : inputArrays) {
	    int mediator = 0;

	    mediator = outputArray[query[FIRST_NUMBER]];
	    outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]];
	    outputArray[query[SECOND_NUMBER]] = mediator;

	}

    }
} Main public static final int FIRST_NUMBER = 0; FIRST_NUMBER 0 public static final int SECOND_NUMBER = 1; SECOND_NUMBER 1 public static void main(String[] args) {

	Scanner sc = new Scanner(System.in);
	// ?¨??????\?????¨????????????????£?
	int arrayLength = Integer.parseInt(sc.nextLine());
	int loopCount = Integer.parseInt(sc.nextLine());

	// ?????\???????????????
	int[] outputArray = new int[arrayLength + 1];
	for (int i = 0; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	// ??\????????????
	List<int[]> inputArrays = new ArrayList<>();

	for (int i = 0; i < loopCount; i++) {
	    String[] queryStr = sc.nextLine().split(",");
	    int[] query = new int[2];
	    query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]);
	    query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]);
	    inputArrays.add(query);
	}

	// lots???draw?????????????????????outputArray???????´???????
	exchangeLine(inputArrays, outputArray);

	// ?????????????????????
	for (int i = 1; i < outputArray.length; i++) {
	    System.out.println(outputArray[i]);
	}

    } main {

	Scanner sc = new Scanner(System.in);
	// ?¨??????\?????¨????????????????£?
	int arrayLength = Integer.parseInt(sc.nextLine());
	int loopCount = Integer.parseInt(sc.nextLine());

	// ?????\???????????????
	int[] outputArray = new int[arrayLength + 1];
	for (int i = 0; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	// ??\????????????
	List<int[]> inputArrays = new ArrayList<>();

	for (int i = 0; i < loopCount; i++) {
	    String[] queryStr = sc.nextLine().split(",");
	    int[] query = new int[2];
	    query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]);
	    query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]);
	    inputArrays.add(query);
	}

	// lots???draw?????????????????????outputArray???????´???????
	exchangeLine(inputArrays, outputArray);

	// ?????????????????????
	for (int i = 1; i < outputArray.length; i++) {
	    System.out.println(outputArray[i]);
	}

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int arrayLength = Integer.parseInt(sc.nextLine()); arrayLength Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int loopCount = Integer.parseInt(sc.nextLine()); loopCount Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int[] outputArray = new int[arrayLength + 1]; outputArray new int[arrayLength + 1] arrayLength + 1 arrayLength 1 for (int i = 0; i < outputArray.length; i++) {
	    outputArray[i] = i;
	} int i = 0; int i = 0; i 0 i < outputArray.length i outputArray.length outputArray outputArray.length i++ i++ i {
	    outputArray[i] = i;
	} {
	    outputArray[i] = i;
	} outputArray[i] = i outputArray[i] outputArray i i List<int[]> inputArrays = new ArrayList<>(); inputArrays new ArrayList<>() for (int i = 0; i < loopCount; i++) {
	    String[] queryStr = sc.nextLine().split(",");
	    int[] query = new int[2];
	    query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]);
	    query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]);
	    inputArrays.add(query);
	} int i = 0; int i = 0; i 0 i < loopCount i loopCount i++ i++ i {
	    String[] queryStr = sc.nextLine().split(",");
	    int[] query = new int[2];
	    query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]);
	    query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]);
	    inputArrays.add(query);
	} {
	    String[] queryStr = sc.nextLine().split(",");
	    int[] query = new int[2];
	    query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]);
	    query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]);
	    inputArrays.add(query);
	} String[] queryStr = sc.nextLine().split(","); queryStr sc.nextLine().split(",") sc.nextLine().split sc.nextLine() sc.nextLine sc "," int[] query = new int[2]; query new int[2] 2 query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]) query[FIRST_NUMBER] query FIRST_NUMBER Integer.parseInt(queryStr[FIRST_NUMBER]) Integer.parseInt Integer queryStr[FIRST_NUMBER] queryStr FIRST_NUMBER query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]) query[SECOND_NUMBER] query SECOND_NUMBER Integer.parseInt(queryStr[SECOND_NUMBER]) Integer.parseInt Integer queryStr[SECOND_NUMBER] queryStr SECOND_NUMBER inputArrays.add(query) inputArrays.add inputArrays query exchangeLine(inputArrays, outputArray) exchangeLine inputArrays outputArray for (int i = 1; i < outputArray.length; i++) {
	    System.out.println(outputArray[i]);
	} int i = 1; int i = 1; i 1 i < outputArray.length i outputArray.length outputArray outputArray.length i++ i++ i {
	    System.out.println(outputArray[i]);
	} {
	    System.out.println(outputArray[i]);
	} System.out.println(outputArray[i]) System.out.println System.out System System.out outputArray[i] outputArray i String[] args args private static void exchangeLine(List<int[]> inputArrays, int[] outputArray) {

	for (int[] query : inputArrays) {
	    int mediator = 0;

	    mediator = outputArray[query[FIRST_NUMBER]];
	    outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]];
	    outputArray[query[SECOND_NUMBER]] = mediator;

	}

    } exchangeLine {

	for (int[] query : inputArrays) {
	    int mediator = 0;

	    mediator = outputArray[query[FIRST_NUMBER]];
	    outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]];
	    outputArray[query[SECOND_NUMBER]] = mediator;

	}

    } for (int[] query : inputArrays) {
	    int mediator = 0;

	    mediator = outputArray[query[FIRST_NUMBER]];
	    outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]];
	    outputArray[query[SECOND_NUMBER]] = mediator;

	} int[] query inputArrays {
	    int mediator = 0;

	    mediator = outputArray[query[FIRST_NUMBER]];
	    outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]];
	    outputArray[query[SECOND_NUMBER]] = mediator;

	} {
	    int mediator = 0;

	    mediator = outputArray[query[FIRST_NUMBER]];
	    outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]];
	    outputArray[query[SECOND_NUMBER]] = mediator;

	} int mediator = 0; mediator 0 mediator = outputArray[query[FIRST_NUMBER]] mediator outputArray[query[FIRST_NUMBER]] outputArray query[FIRST_NUMBER] query FIRST_NUMBER outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]] outputArray[query[FIRST_NUMBER]] outputArray query[FIRST_NUMBER] query FIRST_NUMBER outputArray[query[SECOND_NUMBER]] outputArray query[SECOND_NUMBER] query SECOND_NUMBER outputArray[query[SECOND_NUMBER]] = mediator outputArray[query[SECOND_NUMBER]] outputArray query[SECOND_NUMBER] query SECOND_NUMBER mediator List<int[]> inputArrays inputArrays int[] outputArray outputArray public class Main{

    public static final int FIRST_NUMBER = 0;
    public static final int SECOND_NUMBER = 1;

    public static void main(String[] args) {

	Scanner sc = new Scanner(System.in);
	// ?¨??????\?????¨????????????????£?
	int arrayLength = Integer.parseInt(sc.nextLine());
	int loopCount = Integer.parseInt(sc.nextLine());

	// ?????\???????????????
	int[] outputArray = new int[arrayLength + 1];
	for (int i = 0; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	// ??\????????????
	List<int[]> inputArrays = new ArrayList<>();

	for (int i = 0; i < loopCount; i++) {
	    String[] queryStr = sc.nextLine().split(",");
	    int[] query = new int[2];
	    query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]);
	    query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]);
	    inputArrays.add(query);
	}

	// lots???draw?????????????????????outputArray???????´???????
	exchangeLine(inputArrays, outputArray);

	// ?????????????????????
	for (int i = 1; i < outputArray.length; i++) {
	    System.out.println(outputArray[i]);
	}

    }

    private static void exchangeLine(List<int[]> inputArrays, int[] outputArray) {

	for (int[] query : inputArrays) {
	    int mediator = 0;

	    mediator = outputArray[query[FIRST_NUMBER]];
	    outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]];
	    outputArray[query[SECOND_NUMBER]] = mediator;

	}

    }
} public class Main{

    public static final int FIRST_NUMBER = 0;
    public static final int SECOND_NUMBER = 1;

    public static void main(String[] args) {

	Scanner sc = new Scanner(System.in);
	// ?¨??????\?????¨????????????????£?
	int arrayLength = Integer.parseInt(sc.nextLine());
	int loopCount = Integer.parseInt(sc.nextLine());

	// ?????\???????????????
	int[] outputArray = new int[arrayLength + 1];
	for (int i = 0; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	// ??\????????????
	List<int[]> inputArrays = new ArrayList<>();

	for (int i = 0; i < loopCount; i++) {
	    String[] queryStr = sc.nextLine().split(",");
	    int[] query = new int[2];
	    query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]);
	    query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]);
	    inputArrays.add(query);
	}

	// lots???draw?????????????????????outputArray???????´???????
	exchangeLine(inputArrays, outputArray);

	// ?????????????????????
	for (int i = 1; i < outputArray.length; i++) {
	    System.out.println(outputArray[i]);
	}

    }

    private static void exchangeLine(List<int[]> inputArrays, int[] outputArray) {

	for (int[] query : inputArrays) {
	    int mediator = 0;

	    mediator = outputArray[query[FIRST_NUMBER]];
	    outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]];
	    outputArray[query[SECOND_NUMBER]] = mediator;

	}

    }
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{

    public static final int FIRST_NUMBER = 0;
    public static final int SECOND_NUMBER = 1;

    public static void main(String[] args) {

	Scanner sc = new Scanner(System.in);
	// ?¨??????\?????¨????????????????£?
	int arrayLength = Integer.parseInt(sc.nextLine());
	int loopCount = Integer.parseInt(sc.nextLine());

	// ?????\???????????????
	int[] outputArray = new int[arrayLength + 1];
	for (int i = 0; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	// ??\????????????
	List<int[]> inputArrays = new ArrayList<>();

	for (int i = 0; i < loopCount; i++) {
	    String[] queryStr = sc.nextLine().split(",");
	    int[] query = new int[2];
	    query[FIRST_NUMBER] = Integer.parseInt(queryStr[FIRST_NUMBER]);
	    query[SECOND_NUMBER] = Integer.parseInt(queryStr[SECOND_NUMBER]);
	    inputArrays.add(query);
	}

	// lots???draw?????????????????????outputArray???????´???????
	exchangeLine(inputArrays, outputArray);

	// ?????????????????????
	for (int i = 1; i < outputArray.length; i++) {
	    System.out.println(outputArray[i]);
	}

    }

    private static void exchangeLine(List<int[]> inputArrays, int[] outputArray) {

	for (int[] query : inputArrays) {
	    int mediator = 0;

	    mediator = outputArray[query[FIRST_NUMBER]];
	    outputArray[query[FIRST_NUMBER]] = outputArray[query[SECOND_NUMBER]];
	    outputArray[query[SECOND_NUMBER]] = mediator;

	}

    }
}