import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main{

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

    public static void main(String[] args) throws NumberFormatException, IOException {

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	int vertical = Integer.parseInt(br.readLine());
	int horizontal = Integer.parseInt(br.readLine());

	/*
	 * for (int i = 0; i < horizontal; i++) {
	 * 
	 * }
	 */

	//
	List<int[]> inputArrays = new ArrayList<>();
	for (int i = 0; i < horizontal; i++) {
	    String[] queryStr = br.readLine().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[] outputArray = getDrawedArray(inputArrays, vertical, horizontal);

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

    }

    private static int[] getDrawedArray(List<int[]> inputArrays, int amidaLength, int loopCount) {
	// ?????\?????????????????????????????????????????????
	// outputArray[0]????????¨?????????
	int[] outputArray = new int[amidaLength + 1];
	for (int i = 1; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	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;

	}

	return outputArray;

    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List 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) throws NumberFormatException, IOException {

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	int vertical = Integer.parseInt(br.readLine());
	int horizontal = Integer.parseInt(br.readLine());

	/*
	 * for (int i = 0; i < horizontal; i++) {
	 * 
	 * }
	 */

	//
	List<int[]> inputArrays = new ArrayList<>();
	for (int i = 0; i < horizontal; i++) {
	    String[] queryStr = br.readLine().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[] outputArray = getDrawedArray(inputArrays, vertical, horizontal);

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

    }

    private static int[] getDrawedArray(List<int[]> inputArrays, int amidaLength, int loopCount) {
	// ?????\?????????????????????????????????????????????
	// outputArray[0]????????¨?????????
	int[] outputArray = new int[amidaLength + 1];
	for (int i = 1; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	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;

	}

	return outputArray;

    }

} 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) throws NumberFormatException, IOException {

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	int vertical = Integer.parseInt(br.readLine());
	int horizontal = Integer.parseInt(br.readLine());

	/*
	 * for (int i = 0; i < horizontal; i++) {
	 * 
	 * }
	 */

	//
	List<int[]> inputArrays = new ArrayList<>();
	for (int i = 0; i < horizontal; i++) {
	    String[] queryStr = br.readLine().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[] outputArray = getDrawedArray(inputArrays, vertical, horizontal);

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

    } main {

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	int vertical = Integer.parseInt(br.readLine());
	int horizontal = Integer.parseInt(br.readLine());

	/*
	 * for (int i = 0; i < horizontal; i++) {
	 * 
	 * }
	 */

	//
	List<int[]> inputArrays = new ArrayList<>();
	for (int i = 0; i < horizontal; i++) {
	    String[] queryStr = br.readLine().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[] outputArray = getDrawedArray(inputArrays, vertical, horizontal);

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

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int vertical = Integer.parseInt(br.readLine()); vertical Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int horizontal = Integer.parseInt(br.readLine()); horizontal Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br List<int[]> inputArrays = new ArrayList<>(); inputArrays new ArrayList<>() for (int i = 0; i < horizontal; i++) {
	    String[] queryStr = br.readLine().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 < horizontal i horizontal i++ i++ i {
	    String[] queryStr = br.readLine().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 = br.readLine().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 = br.readLine().split(","); queryStr br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," 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 int[] outputArray = getDrawedArray(inputArrays, vertical, horizontal); outputArray getDrawedArray(inputArrays, vertical, horizontal) getDrawedArray inputArrays vertical horizontal 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 int[] getDrawedArray(List<int[]> inputArrays, int amidaLength, int loopCount) {
	// ?????\?????????????????????????????????????????????
	// outputArray[0]????????¨?????????
	int[] outputArray = new int[amidaLength + 1];
	for (int i = 1; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	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;

	}

	return outputArray;

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

	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;

	}

	return outputArray;

    } int[] outputArray = new int[amidaLength + 1]; outputArray new int[amidaLength + 1] amidaLength + 1 amidaLength 1 for (int i = 1; i < outputArray.length; i++) {
	    outputArray[i] = i;
	} int i = 1; int i = 1; i 1 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 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 return outputArray; outputArray List<int[]> inputArrays inputArrays int amidaLength amidaLength int loopCount loopCount public class Main{

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

    public static void main(String[] args) throws NumberFormatException, IOException {

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	int vertical = Integer.parseInt(br.readLine());
	int horizontal = Integer.parseInt(br.readLine());

	/*
	 * for (int i = 0; i < horizontal; i++) {
	 * 
	 * }
	 */

	//
	List<int[]> inputArrays = new ArrayList<>();
	for (int i = 0; i < horizontal; i++) {
	    String[] queryStr = br.readLine().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[] outputArray = getDrawedArray(inputArrays, vertical, horizontal);

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

    }

    private static int[] getDrawedArray(List<int[]> inputArrays, int amidaLength, int loopCount) {
	// ?????\?????????????????????????????????????????????
	// outputArray[0]????????¨?????????
	int[] outputArray = new int[amidaLength + 1];
	for (int i = 1; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	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;

	}

	return outputArray;

    }

} public class Main{

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

    public static void main(String[] args) throws NumberFormatException, IOException {

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	int vertical = Integer.parseInt(br.readLine());
	int horizontal = Integer.parseInt(br.readLine());

	/*
	 * for (int i = 0; i < horizontal; i++) {
	 * 
	 * }
	 */

	//
	List<int[]> inputArrays = new ArrayList<>();
	for (int i = 0; i < horizontal; i++) {
	    String[] queryStr = br.readLine().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[] outputArray = getDrawedArray(inputArrays, vertical, horizontal);

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

    }

    private static int[] getDrawedArray(List<int[]> inputArrays, int amidaLength, int loopCount) {
	// ?????\?????????????????????????????????????????????
	// outputArray[0]????????¨?????????
	int[] outputArray = new int[amidaLength + 1];
	for (int i = 1; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	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;

	}

	return outputArray;

    }

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main{

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

    public static void main(String[] args) throws NumberFormatException, IOException {

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	int vertical = Integer.parseInt(br.readLine());
	int horizontal = Integer.parseInt(br.readLine());

	/*
	 * for (int i = 0; i < horizontal; i++) {
	 * 
	 * }
	 */

	//
	List<int[]> inputArrays = new ArrayList<>();
	for (int i = 0; i < horizontal; i++) {
	    String[] queryStr = br.readLine().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[] outputArray = getDrawedArray(inputArrays, vertical, horizontal);

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

    }

    private static int[] getDrawedArray(List<int[]> inputArrays, int amidaLength, int loopCount) {
	// ?????\?????????????????????????????????????????????
	// outputArray[0]????????¨?????????
	int[] outputArray = new int[amidaLength + 1];
	for (int i = 1; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	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;

	}

	return outputArray;

    }

}