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

class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try{
			int verLineNum = Integer.parseInt(br.readLine()); //tate
			int horLineNum = Integer.parseInt(br.readLine()); //yoko
			ArrayList<Integer[]> horLineList = new ArrayList<Integer[]>();
			for(int i=0;i<horLineNum;i++){
				String[] lineStr = br.readLine().split(",");
				Integer[] lineInfo = new Integer[2];
				for(int j=0;j<lineInfo.length;j++){
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				}
				horLineList.add(lineInfo);
			}
			
			for(int i : SortGoalLine(verLineNum, horLineList)){
				System.out.println(i);
			}
		}
		catch(Exception e){
			return;
		}
		finally{
			try {
				br.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				return;
			}
		}
	}
	
	private static Integer[] SortGoalLine(int verLineNum,List<Integer[]> horizonLineList){
		Integer[] goalNum = new Integer[verLineNum];
		for(int i=0;i<goalNum.length;i++){
			goalNum[i] = i+1;
		}
		
		for(Integer[] i : horizonLineList){
			int temp = goalNum[i[0]-1];
			goalNum[i[0]-1] = goalNum[i[1]-1];
			goalNum[i[1]-1] = temp;
		}
		
		return goalNum;
	}

} 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 class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try{
			int verLineNum = Integer.parseInt(br.readLine()); //tate
			int horLineNum = Integer.parseInt(br.readLine()); //yoko
			ArrayList<Integer[]> horLineList = new ArrayList<Integer[]>();
			for(int i=0;i<horLineNum;i++){
				String[] lineStr = br.readLine().split(",");
				Integer[] lineInfo = new Integer[2];
				for(int j=0;j<lineInfo.length;j++){
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				}
				horLineList.add(lineInfo);
			}
			
			for(int i : SortGoalLine(verLineNum, horLineList)){
				System.out.println(i);
			}
		}
		catch(Exception e){
			return;
		}
		finally{
			try {
				br.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				return;
			}
		}
	}
	
	private static Integer[] SortGoalLine(int verLineNum,List<Integer[]> horizonLineList){
		Integer[] goalNum = new Integer[verLineNum];
		for(int i=0;i<goalNum.length;i++){
			goalNum[i] = i+1;
		}
		
		for(Integer[] i : horizonLineList){
			int temp = goalNum[i[0]-1];
			goalNum[i[0]-1] = goalNum[i[1]-1];
			goalNum[i[1]-1] = temp;
		}
		
		return goalNum;
	}

} Main /**
	 * @param args
	 */
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try{
			int verLineNum = Integer.parseInt(br.readLine()); //tate
			int horLineNum = Integer.parseInt(br.readLine()); //yoko
			ArrayList<Integer[]> horLineList = new ArrayList<Integer[]>();
			for(int i=0;i<horLineNum;i++){
				String[] lineStr = br.readLine().split(",");
				Integer[] lineInfo = new Integer[2];
				for(int j=0;j<lineInfo.length;j++){
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				}
				horLineList.add(lineInfo);
			}
			
			for(int i : SortGoalLine(verLineNum, horLineList)){
				System.out.println(i);
			}
		}
		catch(Exception e){
			return;
		}
		finally{
			try {
				br.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				return;
			}
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try{
			int verLineNum = Integer.parseInt(br.readLine()); //tate
			int horLineNum = Integer.parseInt(br.readLine()); //yoko
			ArrayList<Integer[]> horLineList = new ArrayList<Integer[]>();
			for(int i=0;i<horLineNum;i++){
				String[] lineStr = br.readLine().split(",");
				Integer[] lineInfo = new Integer[2];
				for(int j=0;j<lineInfo.length;j++){
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				}
				horLineList.add(lineInfo);
			}
			
			for(int i : SortGoalLine(verLineNum, horLineList)){
				System.out.println(i);
			}
		}
		catch(Exception e){
			return;
		}
		finally{
			try {
				br.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				return;
			}
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try{
			int verLineNum = Integer.parseInt(br.readLine()); //tate
			int horLineNum = Integer.parseInt(br.readLine()); //yoko
			ArrayList<Integer[]> horLineList = new ArrayList<Integer[]>();
			for(int i=0;i<horLineNum;i++){
				String[] lineStr = br.readLine().split(",");
				Integer[] lineInfo = new Integer[2];
				for(int j=0;j<lineInfo.length;j++){
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				}
				horLineList.add(lineInfo);
			}
			
			for(int i : SortGoalLine(verLineNum, horLineList)){
				System.out.println(i);
			}
		}
		catch(Exception e){
			return;
		}
		finally{
			try {
				br.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				return;
			}
		} catch(Exception e){
			return;
		} Exception e {
			return;
		} return; {
			try {
				br.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				return;
			}
		} try {
				br.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				return;
			} catch (IOException e) {
				// TODO Auto-generated catch block
				return;
			} IOException e {
				// TODO Auto-generated catch block
				return;
			} return; {
				br.close();
			} br.close() br.close br {
			int verLineNum = Integer.parseInt(br.readLine()); //tate
			int horLineNum = Integer.parseInt(br.readLine()); //yoko
			ArrayList<Integer[]> horLineList = new ArrayList<Integer[]>();
			for(int i=0;i<horLineNum;i++){
				String[] lineStr = br.readLine().split(",");
				Integer[] lineInfo = new Integer[2];
				for(int j=0;j<lineInfo.length;j++){
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				}
				horLineList.add(lineInfo);
			}
			
			for(int i : SortGoalLine(verLineNum, horLineList)){
				System.out.println(i);
			}
		} int verLineNum = Integer.parseInt(br.readLine()); verLineNum Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int horLineNum = Integer.parseInt(br.readLine()); horLineNum Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br ArrayList<Integer[]> horLineList = new ArrayList<Integer[]>(); horLineList new ArrayList<Integer[]>() for(int i=0;i<horLineNum;i++){
				String[] lineStr = br.readLine().split(",");
				Integer[] lineInfo = new Integer[2];
				for(int j=0;j<lineInfo.length;j++){
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				}
				horLineList.add(lineInfo);
			} int i=0; int i=0; i 0 i<horLineNum i horLineNum i++ i++ i {
				String[] lineStr = br.readLine().split(",");
				Integer[] lineInfo = new Integer[2];
				for(int j=0;j<lineInfo.length;j++){
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				}
				horLineList.add(lineInfo);
			} {
				String[] lineStr = br.readLine().split(",");
				Integer[] lineInfo = new Integer[2];
				for(int j=0;j<lineInfo.length;j++){
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				}
				horLineList.add(lineInfo);
			} String[] lineStr = br.readLine().split(","); lineStr br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," Integer[] lineInfo = new Integer[2]; lineInfo new Integer[2] 2 for(int j=0;j<lineInfo.length;j++){
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				} int j=0; int j=0; j 0 j<lineInfo.length j lineInfo.length lineInfo lineInfo.length j++ j++ j {
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				} {
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				} lineInfo[j] = Integer.parseInt(lineStr[j]) lineInfo[j] lineInfo j Integer.parseInt(lineStr[j]) Integer.parseInt Integer lineStr[j] lineStr j horLineList.add(lineInfo) horLineList.add horLineList lineInfo for(int i : SortGoalLine(verLineNum, horLineList)){
				System.out.println(i);
			} int i SortGoalLine(verLineNum, horLineList) SortGoalLine verLineNum horLineList {
				System.out.println(i);
			} {
				System.out.println(i);
			} System.out.println(i) System.out.println System.out System System.out i String[] args args private static Integer[] SortGoalLine(int verLineNum,List<Integer[]> horizonLineList){
		Integer[] goalNum = new Integer[verLineNum];
		for(int i=0;i<goalNum.length;i++){
			goalNum[i] = i+1;
		}
		
		for(Integer[] i : horizonLineList){
			int temp = goalNum[i[0]-1];
			goalNum[i[0]-1] = goalNum[i[1]-1];
			goalNum[i[1]-1] = temp;
		}
		
		return goalNum;
	} SortGoalLine {
		Integer[] goalNum = new Integer[verLineNum];
		for(int i=0;i<goalNum.length;i++){
			goalNum[i] = i+1;
		}
		
		for(Integer[] i : horizonLineList){
			int temp = goalNum[i[0]-1];
			goalNum[i[0]-1] = goalNum[i[1]-1];
			goalNum[i[1]-1] = temp;
		}
		
		return goalNum;
	} Integer[] goalNum = new Integer[verLineNum]; goalNum new Integer[verLineNum] verLineNum for(int i=0;i<goalNum.length;i++){
			goalNum[i] = i+1;
		} int i=0; int i=0; i 0 i<goalNum.length i goalNum.length goalNum goalNum.length i++ i++ i {
			goalNum[i] = i+1;
		} {
			goalNum[i] = i+1;
		} goalNum[i] = i+1 goalNum[i] goalNum i i+1 i 1 for(Integer[] i : horizonLineList){
			int temp = goalNum[i[0]-1];
			goalNum[i[0]-1] = goalNum[i[1]-1];
			goalNum[i[1]-1] = temp;
		} Integer[] i horizonLineList {
			int temp = goalNum[i[0]-1];
			goalNum[i[0]-1] = goalNum[i[1]-1];
			goalNum[i[1]-1] = temp;
		} {
			int temp = goalNum[i[0]-1];
			goalNum[i[0]-1] = goalNum[i[1]-1];
			goalNum[i[1]-1] = temp;
		} int temp = goalNum[i[0]-1]; temp goalNum[i[0]-1] goalNum i[0]-1 i[0] i 0 1 goalNum[i[0]-1] = goalNum[i[1]-1] goalNum[i[0]-1] goalNum i[0]-1 i[0] i 0 1 goalNum[i[1]-1] goalNum i[1]-1 i[1] i 1 1 goalNum[i[1]-1] = temp goalNum[i[1]-1] goalNum i[1]-1 i[1] i 1 1 temp return goalNum; goalNum int verLineNum verLineNum List<Integer[]> horizonLineList horizonLineList
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try{
			int verLineNum = Integer.parseInt(br.readLine()); //tate
			int horLineNum = Integer.parseInt(br.readLine()); //yoko
			ArrayList<Integer[]> horLineList = new ArrayList<Integer[]>();
			for(int i=0;i<horLineNum;i++){
				String[] lineStr = br.readLine().split(",");
				Integer[] lineInfo = new Integer[2];
				for(int j=0;j<lineInfo.length;j++){
					lineInfo[j] = Integer.parseInt(lineStr[j]);
				}
				horLineList.add(lineInfo);
			}
			
			for(int i : SortGoalLine(verLineNum, horLineList)){
				System.out.println(i);
			}
		}
		catch(Exception e){
			return;
		}
		finally{
			try {
				br.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				return;
			}
		}
	}
	
	private static Integer[] SortGoalLine(int verLineNum,List<Integer[]> horizonLineList){
		Integer[] goalNum = new Integer[verLineNum];
		for(int i=0;i<goalNum.length;i++){
			goalNum[i] = i+1;
		}
		
		for(Integer[] i : horizonLineList){
			int temp = goalNum[i[0]-1];
			goalNum[i[0]-1] = goalNum[i[1]-1];
			goalNum[i[1]-1] = temp;
		}
		
		return goalNum;
	}

}