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

class Main {
    public static void main(String[] args) {
        try {
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        	int verticalLineNum = Integer.parseInt(br.readLine());
        	int horizontalLineNum = Integer.parseInt(br.readLine());

        	List<Integer> numberList = new ArrayList<>();

        	for(int i = 1; i <= verticalLineNum; i++) {
        		numberList.add(i);
        	}

        	for(int j = 0; j < horizontalLineNum; j++) {
        		String line = br.readLine();
                String[] dataSet = line.split(",");

                numberList = swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
        	}


        	for(int k = 0; k < verticalLineNum; k++) {
        		System.out.println(numberList.get(k));
        	}

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

	private static List<Integer> swap(List<Integer> numberList, int a, int b) {
		int temp = numberList.get(a-1);
		numberList.set(a-1, numberList.get(b-1));
		numberList.set(b-1, temp);
        return numberList;
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util class Main {
    public static void main(String[] args) {
        try {
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        	int verticalLineNum = Integer.parseInt(br.readLine());
        	int horizontalLineNum = Integer.parseInt(br.readLine());

        	List<Integer> numberList = new ArrayList<>();

        	for(int i = 1; i <= verticalLineNum; i++) {
        		numberList.add(i);
        	}

        	for(int j = 0; j < horizontalLineNum; j++) {
        		String line = br.readLine();
                String[] dataSet = line.split(",");

                numberList = swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
        	}


        	for(int k = 0; k < verticalLineNum; k++) {
        		System.out.println(numberList.get(k));
        	}

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

	private static List<Integer> swap(List<Integer> numberList, int a, int b) {
		int temp = numberList.get(a-1);
		numberList.set(a-1, numberList.get(b-1));
		numberList.set(b-1, temp);
        return numberList;
	}

} Main public static void main(String[] args) {
        try {
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        	int verticalLineNum = Integer.parseInt(br.readLine());
        	int horizontalLineNum = Integer.parseInt(br.readLine());

        	List<Integer> numberList = new ArrayList<>();

        	for(int i = 1; i <= verticalLineNum; i++) {
        		numberList.add(i);
        	}

        	for(int j = 0; j < horizontalLineNum; j++) {
        		String line = br.readLine();
                String[] dataSet = line.split(",");

                numberList = swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
        	}


        	for(int k = 0; k < verticalLineNum; k++) {
        		System.out.println(numberList.get(k));
        	}

        } catch (Exception e) {
            e.printStackTrace();
        }
    } main {
        try {
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        	int verticalLineNum = Integer.parseInt(br.readLine());
        	int horizontalLineNum = Integer.parseInt(br.readLine());

        	List<Integer> numberList = new ArrayList<>();

        	for(int i = 1; i <= verticalLineNum; i++) {
        		numberList.add(i);
        	}

        	for(int j = 0; j < horizontalLineNum; j++) {
        		String line = br.readLine();
                String[] dataSet = line.split(",");

                numberList = swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
        	}


        	for(int k = 0; k < verticalLineNum; k++) {
        		System.out.println(numberList.get(k));
        	}

        } catch (Exception e) {
            e.printStackTrace();
        }
    } try {
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        	int verticalLineNum = Integer.parseInt(br.readLine());
        	int horizontalLineNum = Integer.parseInt(br.readLine());

        	List<Integer> numberList = new ArrayList<>();

        	for(int i = 1; i <= verticalLineNum; i++) {
        		numberList.add(i);
        	}

        	for(int j = 0; j < horizontalLineNum; j++) {
        		String line = br.readLine();
                String[] dataSet = line.split(",");

                numberList = swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
        	}


        	for(int k = 0; k < verticalLineNum; k++) {
        		System.out.println(numberList.get(k));
        	}

        } catch (Exception e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } Exception e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        	int verticalLineNum = Integer.parseInt(br.readLine());
        	int horizontalLineNum = Integer.parseInt(br.readLine());

        	List<Integer> numberList = new ArrayList<>();

        	for(int i = 1; i <= verticalLineNum; i++) {
        		numberList.add(i);
        	}

        	for(int j = 0; j < horizontalLineNum; j++) {
        		String line = br.readLine();
                String[] dataSet = line.split(",");

                numberList = swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
        	}


        	for(int k = 0; k < verticalLineNum; k++) {
        		System.out.println(numberList.get(k));
        	}

        } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int verticalLineNum = Integer.parseInt(br.readLine()); verticalLineNum Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int horizontalLineNum = Integer.parseInt(br.readLine()); horizontalLineNum Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br List<Integer> numberList = new ArrayList<>(); numberList new ArrayList<>() for(int i = 1; i <= verticalLineNum; i++) {
        		numberList.add(i);
        	} int i = 1; int i = 1; i 1 i <= verticalLineNum i verticalLineNum i++ i++ i {
        		numberList.add(i);
        	} {
        		numberList.add(i);
        	} numberList.add(i) numberList.add numberList i for(int j = 0; j < horizontalLineNum; j++) {
        		String line = br.readLine();
                String[] dataSet = line.split(",");

                numberList = swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
        	} int j = 0; int j = 0; j 0 j < horizontalLineNum j horizontalLineNum j++ j++ j {
        		String line = br.readLine();
                String[] dataSet = line.split(",");

                numberList = swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
        	} {
        		String line = br.readLine();
                String[] dataSet = line.split(",");

                numberList = swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
        	} String line = br.readLine(); line br.readLine() br.readLine br String[] dataSet = line.split(","); dataSet line.split(",") line.split line "," numberList = swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1])) numberList swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1])) swap numberList Integer.parseInt(dataSet[0]) Integer.parseInt Integer dataSet[0] dataSet 0 Integer.parseInt(dataSet[1]) Integer.parseInt Integer dataSet[1] dataSet 1 for(int k = 0; k < verticalLineNum; k++) {
        		System.out.println(numberList.get(k));
        	} int k = 0; int k = 0; k 0 k < verticalLineNum k verticalLineNum k++ k++ k {
        		System.out.println(numberList.get(k));
        	} {
        		System.out.println(numberList.get(k));
        	} System.out.println(numberList.get(k)) System.out.println System.out System System.out numberList.get(k) numberList.get numberList k String[] args args private static List<Integer> swap(List<Integer> numberList, int a, int b) {
		int temp = numberList.get(a-1);
		numberList.set(a-1, numberList.get(b-1));
		numberList.set(b-1, temp);
        return numberList;
	} swap {
		int temp = numberList.get(a-1);
		numberList.set(a-1, numberList.get(b-1));
		numberList.set(b-1, temp);
        return numberList;
	} int temp = numberList.get(a-1); temp numberList.get(a-1) numberList.get numberList a-1 a 1 numberList.set(a-1, numberList.get(b-1)) numberList.set numberList a-1 a 1 numberList.get(b-1) numberList.get numberList b-1 b 1 numberList.set(b-1, temp) numberList.set numberList b-1 b 1 temp return numberList; numberList List<Integer> numberList numberList int a a int b b
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main {
    public static void main(String[] args) {
        try {
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        	int verticalLineNum = Integer.parseInt(br.readLine());
        	int horizontalLineNum = Integer.parseInt(br.readLine());

        	List<Integer> numberList = new ArrayList<>();

        	for(int i = 1; i <= verticalLineNum; i++) {
        		numberList.add(i);
        	}

        	for(int j = 0; j < horizontalLineNum; j++) {
        		String line = br.readLine();
                String[] dataSet = line.split(",");

                numberList = swap(numberList, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
        	}


        	for(int k = 0; k < verticalLineNum; k++) {
        		System.out.println(numberList.get(k));
        	}

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

	private static List<Integer> swap(List<Integer> numberList, int a, int b) {
		int temp = numberList.get(a-1);
		numberList.set(a-1, numberList.get(b-1));
		numberList.set(b-1, temp);
        return numberList;
	}

}