
import java.io.*;
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 verticalLine = Integer.parseInt(br.readLine());//???????????¬??°
			int horizontalLine = Integer.parseInt(br.readLine());//?¨?????????°
			List<Integer> lots = new ArrayList<>();//?????????????´????????????????
			
			for(int i=0; i<verticalLine; i++){
				lots.add(i+1);//???????????????????????????????????????????????? ex) ???????????°??????1??????????????????[1], 2??????????????????[2]...
			}
			
			for(int j=1; j<horizontalLine+1; j++){
				String line = br.readLine();
				String[] dataSet = line.split(",");
				
				lots = swap(lots, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
			}
			
			for(int k=0; k<lots.size(); k++){
				System.out.println(lots.get(k));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/*
	 * ???????????\????????????????????????
	 * @param ??????????????????????´???????????????????
	 * @param ??\????????????????????????????????????
	 * @param ??\????????????????????????????????????
	 *
	 */
	private static List<Integer> swap(List<Integer> lots, int index1, int index2) {
		int tmp = lots.get(index1-1);
		lots.set(index1-1, lots.get(index2-1));
	    lots.set(index2-1, tmp);
	    return lots;
	}
} import java.io.*; io.* java 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 verticalLine = Integer.parseInt(br.readLine());//???????????¬??°
			int horizontalLine = Integer.parseInt(br.readLine());//?¨?????????°
			List<Integer> lots = new ArrayList<>();//?????????????´????????????????
			
			for(int i=0; i<verticalLine; i++){
				lots.add(i+1);//???????????????????????????????????????????????? ex) ???????????°??????1??????????????????[1], 2??????????????????[2]...
			}
			
			for(int j=1; j<horizontalLine+1; j++){
				String line = br.readLine();
				String[] dataSet = line.split(",");
				
				lots = swap(lots, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
			}
			
			for(int k=0; k<lots.size(); k++){
				System.out.println(lots.get(k));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/*
	 * ???????????\????????????????????????
	 * @param ??????????????????????´???????????????????
	 * @param ??\????????????????????????????????????
	 * @param ??\????????????????????????????????????
	 *
	 */
	private static List<Integer> swap(List<Integer> lots, int index1, int index2) {
		int tmp = lots.get(index1-1);
		lots.set(index1-1, lots.get(index2-1));
	    lots.set(index2-1, tmp);
	    return lots;
	}
} Main public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			
			int verticalLine = Integer.parseInt(br.readLine());//???????????¬??°
			int horizontalLine = Integer.parseInt(br.readLine());//?¨?????????°
			List<Integer> lots = new ArrayList<>();//?????????????´????????????????
			
			for(int i=0; i<verticalLine; i++){
				lots.add(i+1);//???????????????????????????????????????????????? ex) ???????????°??????1??????????????????[1], 2??????????????????[2]...
			}
			
			for(int j=1; j<horizontalLine+1; j++){
				String line = br.readLine();
				String[] dataSet = line.split(",");
				
				lots = swap(lots, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
			}
			
			for(int k=0; k<lots.size(); k++){
				System.out.println(lots.get(k));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	} main {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			
			int verticalLine = Integer.parseInt(br.readLine());//???????????¬??°
			int horizontalLine = Integer.parseInt(br.readLine());//?¨?????????°
			List<Integer> lots = new ArrayList<>();//?????????????´????????????????
			
			for(int i=0; i<verticalLine; i++){
				lots.add(i+1);//???????????????????????????????????????????????? ex) ???????????°??????1??????????????????[1], 2??????????????????[2]...
			}
			
			for(int j=1; j<horizontalLine+1; j++){
				String line = br.readLine();
				String[] dataSet = line.split(",");
				
				lots = swap(lots, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
			}
			
			for(int k=0; k<lots.size(); k++){
				System.out.println(lots.get(k));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	} try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			
			int verticalLine = Integer.parseInt(br.readLine());//???????????¬??°
			int horizontalLine = Integer.parseInt(br.readLine());//?¨?????????°
			List<Integer> lots = new ArrayList<>();//?????????????´????????????????
			
			for(int i=0; i<verticalLine; i++){
				lots.add(i+1);//???????????????????????????????????????????????? ex) ???????????°??????1??????????????????[1], 2??????????????????[2]...
			}
			
			for(int j=1; j<horizontalLine+1; j++){
				String line = br.readLine();
				String[] dataSet = line.split(",");
				
				lots = swap(lots, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
			}
			
			for(int k=0; k<lots.size(); k++){
				System.out.println(lots.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 verticalLine = Integer.parseInt(br.readLine());//???????????¬??°
			int horizontalLine = Integer.parseInt(br.readLine());//?¨?????????°
			List<Integer> lots = new ArrayList<>();//?????????????´????????????????
			
			for(int i=0; i<verticalLine; i++){
				lots.add(i+1);//???????????????????????????????????????????????? ex) ???????????°??????1??????????????????[1], 2??????????????????[2]...
			}
			
			for(int j=1; j<horizontalLine+1; j++){
				String line = br.readLine();
				String[] dataSet = line.split(",");
				
				lots = swap(lots, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
			}
			
			for(int k=0; k<lots.size(); k++){
				System.out.println(lots.get(k));
			}
		} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int verticalLine = Integer.parseInt(br.readLine()); verticalLine Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int horizontalLine = Integer.parseInt(br.readLine()); horizontalLine Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br List<Integer> lots = new ArrayList<>(); lots new ArrayList<>() for(int i=0; i<verticalLine; i++){
				lots.add(i+1);//???????????????????????????????????????????????? ex) ???????????°??????1??????????????????[1], 2??????????????????[2]...
			} int i=0; int i=0; i 0 i<verticalLine i verticalLine i++ i++ i {
				lots.add(i+1);//???????????????????????????????????????????????? ex) ???????????°??????1??????????????????[1], 2??????????????????[2]...
			} {
				lots.add(i+1);//???????????????????????????????????????????????? ex) ???????????°??????1??????????????????[1], 2??????????????????[2]...
			} lots.add(i+1) lots.add lots i+1 i 1 for(int j=1; j<horizontalLine+1; j++){
				String line = br.readLine();
				String[] dataSet = line.split(",");
				
				lots = swap(lots, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
			} int j=1; int j=1; j 1 j<horizontalLine+1 j horizontalLine+1 horizontalLine 1 j++ j++ j {
				String line = br.readLine();
				String[] dataSet = line.split(",");
				
				lots = swap(lots, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
			} {
				String line = br.readLine();
				String[] dataSet = line.split(",");
				
				lots = swap(lots, 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 "," lots = swap(lots, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1])) lots swap(lots, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1])) swap lots 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<lots.size(); k++){
				System.out.println(lots.get(k));
			} int k=0; int k=0; k 0 k<lots.size() k lots.size() lots.size lots k++ k++ k {
				System.out.println(lots.get(k));
			} {
				System.out.println(lots.get(k));
			} System.out.println(lots.get(k)) System.out.println System.out System System.out lots.get(k) lots.get lots k String[] args args /*
	 * ???????????\????????????????????????
	 * @param ??????????????????????´???????????????????
	 * @param ??\????????????????????????????????????
	 * @param ??\????????????????????????????????????
	 *
	 */
	private static List<Integer> swap(List<Integer> lots, int index1, int index2) {
		int tmp = lots.get(index1-1);
		lots.set(index1-1, lots.get(index2-1));
	    lots.set(index2-1, tmp);
	    return lots;
	} swap {
		int tmp = lots.get(index1-1);
		lots.set(index1-1, lots.get(index2-1));
	    lots.set(index2-1, tmp);
	    return lots;
	} int tmp = lots.get(index1-1); tmp lots.get(index1-1) lots.get lots index1-1 index1 1 lots.set(index1-1, lots.get(index2-1)) lots.set lots index1-1 index1 1 lots.get(index2-1) lots.get lots index2-1 index2 1 lots.set(index2-1, tmp) lots.set lots index2-1 index2 1 tmp return lots; lots List<Integer> lots lots int index1 index1 int index2 index2

import java.io.*;
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 verticalLine = Integer.parseInt(br.readLine());//???????????¬??°
			int horizontalLine = Integer.parseInt(br.readLine());//?¨?????????°
			List<Integer> lots = new ArrayList<>();//?????????????´????????????????
			
			for(int i=0; i<verticalLine; i++){
				lots.add(i+1);//???????????????????????????????????????????????? ex) ???????????°??????1??????????????????[1], 2??????????????????[2]...
			}
			
			for(int j=1; j<horizontalLine+1; j++){
				String line = br.readLine();
				String[] dataSet = line.split(",");
				
				lots = swap(lots, Integer.parseInt(dataSet[0]), Integer.parseInt(dataSet[1]));
			}
			
			for(int k=0; k<lots.size(); k++){
				System.out.println(lots.get(k));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/*
	 * ???????????\????????????????????????
	 * @param ??????????????????????´???????????????????
	 * @param ??\????????????????????????????????????
	 * @param ??\????????????????????????????????????
	 *
	 */
	private static List<Integer> swap(List<Integer> lots, int index1, int index2) {
		int tmp = lots.get(index1-1);
		lots.set(index1-1, lots.get(index2-1));
	    lots.set(index2-1, tmp);
	    return lots;
	}
}