import java.io.*;

class Main{
	public static void main(String[] argv) throws IOException, NumberFormatException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int lineNum = Integer.parseInt(br.readLine());
		int[] lines = new int[lineNum];
		for(int i=0; i<lineNum; i++){
			lines[i] = i+1;
		}
		
		int excNum = Integer.parseInt(br.readLine());
		for(int i=0; i<excNum; i++){
			String[] e = br.readLine().split(",");
			int tmp = lines[Integer.parseInt(e[0])-1];
			lines[Integer.parseInt(e[0])-1] = lines[Integer.parseInt(e[1])-1];
			lines[Integer.parseInt(e[1])-1] = tmp;
		}
		
		for(int i : lines){
			System.out.println(i);
		}
	}
} import java.io.*; io.* java class Main{
	public static void main(String[] argv) throws IOException, NumberFormatException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int lineNum = Integer.parseInt(br.readLine());
		int[] lines = new int[lineNum];
		for(int i=0; i<lineNum; i++){
			lines[i] = i+1;
		}
		
		int excNum = Integer.parseInt(br.readLine());
		for(int i=0; i<excNum; i++){
			String[] e = br.readLine().split(",");
			int tmp = lines[Integer.parseInt(e[0])-1];
			lines[Integer.parseInt(e[0])-1] = lines[Integer.parseInt(e[1])-1];
			lines[Integer.parseInt(e[1])-1] = tmp;
		}
		
		for(int i : lines){
			System.out.println(i);
		}
	}
} Main public static void main(String[] argv) throws IOException, NumberFormatException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int lineNum = Integer.parseInt(br.readLine());
		int[] lines = new int[lineNum];
		for(int i=0; i<lineNum; i++){
			lines[i] = i+1;
		}
		
		int excNum = Integer.parseInt(br.readLine());
		for(int i=0; i<excNum; i++){
			String[] e = br.readLine().split(",");
			int tmp = lines[Integer.parseInt(e[0])-1];
			lines[Integer.parseInt(e[0])-1] = lines[Integer.parseInt(e[1])-1];
			lines[Integer.parseInt(e[1])-1] = tmp;
		}
		
		for(int i : lines){
			System.out.println(i);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int lineNum = Integer.parseInt(br.readLine());
		int[] lines = new int[lineNum];
		for(int i=0; i<lineNum; i++){
			lines[i] = i+1;
		}
		
		int excNum = Integer.parseInt(br.readLine());
		for(int i=0; i<excNum; i++){
			String[] e = br.readLine().split(",");
			int tmp = lines[Integer.parseInt(e[0])-1];
			lines[Integer.parseInt(e[0])-1] = lines[Integer.parseInt(e[1])-1];
			lines[Integer.parseInt(e[1])-1] = tmp;
		}
		
		for(int i : lines){
			System.out.println(i);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int lineNum = Integer.parseInt(br.readLine()); lineNum Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] lines = new int[lineNum]; lines new int[lineNum] lineNum for(int i=0; i<lineNum; i++){
			lines[i] = i+1;
		} int i=0; int i=0; i 0 i<lineNum i lineNum i++ i++ i {
			lines[i] = i+1;
		} {
			lines[i] = i+1;
		} lines[i] = i+1 lines[i] lines i i+1 i 1 int excNum = Integer.parseInt(br.readLine()); excNum Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for(int i=0; i<excNum; i++){
			String[] e = br.readLine().split(",");
			int tmp = lines[Integer.parseInt(e[0])-1];
			lines[Integer.parseInt(e[0])-1] = lines[Integer.parseInt(e[1])-1];
			lines[Integer.parseInt(e[1])-1] = tmp;
		} int i=0; int i=0; i 0 i<excNum i excNum i++ i++ i {
			String[] e = br.readLine().split(",");
			int tmp = lines[Integer.parseInt(e[0])-1];
			lines[Integer.parseInt(e[0])-1] = lines[Integer.parseInt(e[1])-1];
			lines[Integer.parseInt(e[1])-1] = tmp;
		} {
			String[] e = br.readLine().split(",");
			int tmp = lines[Integer.parseInt(e[0])-1];
			lines[Integer.parseInt(e[0])-1] = lines[Integer.parseInt(e[1])-1];
			lines[Integer.parseInt(e[1])-1] = tmp;
		} String[] e = br.readLine().split(","); e br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," int tmp = lines[Integer.parseInt(e[0])-1]; tmp lines[Integer.parseInt(e[0])-1] lines Integer.parseInt(e[0])-1 Integer.parseInt(e[0]) Integer.parseInt Integer e[0] e 0 1 lines[Integer.parseInt(e[0])-1] = lines[Integer.parseInt(e[1])-1] lines[Integer.parseInt(e[0])-1] lines Integer.parseInt(e[0])-1 Integer.parseInt(e[0]) Integer.parseInt Integer e[0] e 0 1 lines[Integer.parseInt(e[1])-1] lines Integer.parseInt(e[1])-1 Integer.parseInt(e[1]) Integer.parseInt Integer e[1] e 1 1 lines[Integer.parseInt(e[1])-1] = tmp lines[Integer.parseInt(e[1])-1] lines Integer.parseInt(e[1])-1 Integer.parseInt(e[1]) Integer.parseInt Integer e[1] e 1 1 tmp for(int i : lines){
			System.out.println(i);
		} int i lines {
			System.out.println(i);
		} {
			System.out.println(i);
		} System.out.println(i) System.out.println System.out System System.out i String[] argv argv
import java.io.*;

class Main{
	public static void main(String[] argv) throws IOException, NumberFormatException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int lineNum = Integer.parseInt(br.readLine());
		int[] lines = new int[lineNum];
		for(int i=0; i<lineNum; i++){
			lines[i] = i+1;
		}
		
		int excNum = Integer.parseInt(br.readLine());
		for(int i=0; i<excNum; i++){
			String[] e = br.readLine().split(",");
			int tmp = lines[Integer.parseInt(e[0])-1];
			lines[Integer.parseInt(e[0])-1] = lines[Integer.parseInt(e[1])-1];
			lines[Integer.parseInt(e[1])-1] = tmp;
		}
		
		for(int i : lines){
			System.out.println(i);
		}
	}
}