import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		String[] c = new String[2];
		int f=0;
		int s=0;
		int temp = 0;
		int[] amida = new int[w];
		for(int i = 0 ; i < w ; i ++)
			amida[i]=i+1;
		for(int i = 0 ; i < n ; i ++){
			c=br.readLine().split(",");
			f=Integer.parseInt(c[0]);
			s=Integer.parseInt(c[1]);
			temp=amida[f-1];
			amida[f-1]=amida[s-1];
			amida[s-1]=temp;
		}
		for(int i = 0;i<w;i++){
			System.out.println(amida[i]);
		}
	}
} import java.io.*; io.* java public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		String[] c = new String[2];
		int f=0;
		int s=0;
		int temp = 0;
		int[] amida = new int[w];
		for(int i = 0 ; i < w ; i ++)
			amida[i]=i+1;
		for(int i = 0 ; i < n ; i ++){
			c=br.readLine().split(",");
			f=Integer.parseInt(c[0]);
			s=Integer.parseInt(c[1]);
			temp=amida[f-1];
			amida[f-1]=amida[s-1];
			amida[s-1]=temp;
		}
		for(int i = 0;i<w;i++){
			System.out.println(amida[i]);
		}
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		String[] c = new String[2];
		int f=0;
		int s=0;
		int temp = 0;
		int[] amida = new int[w];
		for(int i = 0 ; i < w ; i ++)
			amida[i]=i+1;
		for(int i = 0 ; i < n ; i ++){
			c=br.readLine().split(",");
			f=Integer.parseInt(c[0]);
			s=Integer.parseInt(c[1]);
			temp=amida[f-1];
			amida[f-1]=amida[s-1];
			amida[s-1]=temp;
		}
		for(int i = 0;i<w;i++){
			System.out.println(amida[i]);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		String[] c = new String[2];
		int f=0;
		int s=0;
		int temp = 0;
		int[] amida = new int[w];
		for(int i = 0 ; i < w ; i ++)
			amida[i]=i+1;
		for(int i = 0 ; i < n ; i ++){
			c=br.readLine().split(",");
			f=Integer.parseInt(c[0]);
			s=Integer.parseInt(c[1]);
			temp=amida[f-1];
			amida[f-1]=amida[s-1];
			amida[s-1]=temp;
		}
		for(int i = 0;i<w;i++){
			System.out.println(amida[i]);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int w = Integer.parseInt(br.readLine()); w Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] c = new String[2]; c new String[2] 2 int f=0; f 0 int s=0; s 0 int temp = 0; temp 0 int[] amida = new int[w]; amida new int[w] w for(int i = 0 ; i < w ; i ++)
			amida[i]=i+1; int i = 0 ; int i = 0 ; i 0 i < w i w i ++ i ++ i amida[i]=i+1; amida[i]=i+1 amida[i] amida i i+1 i 1 for(int i = 0 ; i < n ; i ++){
			c=br.readLine().split(",");
			f=Integer.parseInt(c[0]);
			s=Integer.parseInt(c[1]);
			temp=amida[f-1];
			amida[f-1]=amida[s-1];
			amida[s-1]=temp;
		} int i = 0 ; int i = 0 ; i 0 i < n i n i ++ i ++ i {
			c=br.readLine().split(",");
			f=Integer.parseInt(c[0]);
			s=Integer.parseInt(c[1]);
			temp=amida[f-1];
			amida[f-1]=amida[s-1];
			amida[s-1]=temp;
		} {
			c=br.readLine().split(",");
			f=Integer.parseInt(c[0]);
			s=Integer.parseInt(c[1]);
			temp=amida[f-1];
			amida[f-1]=amida[s-1];
			amida[s-1]=temp;
		} c=br.readLine().split(",") c br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," f=Integer.parseInt(c[0]) f Integer.parseInt(c[0]) Integer.parseInt Integer c[0] c 0 s=Integer.parseInt(c[1]) s Integer.parseInt(c[1]) Integer.parseInt Integer c[1] c 1 temp=amida[f-1] temp amida[f-1] amida f-1 f 1 amida[f-1]=amida[s-1] amida[f-1] amida f-1 f 1 amida[s-1] amida s-1 s 1 amida[s-1]=temp amida[s-1] amida s-1 s 1 temp for(int i = 0;i<w;i++){
			System.out.println(amida[i]);
		} int i = 0; int i = 0; i 0 i<w i w i++ i++ i {
			System.out.println(amida[i]);
		} {
			System.out.println(amida[i]);
		} System.out.println(amida[i]) System.out.println System.out System System.out amida[i] amida i String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		String[] c = new String[2];
		int f=0;
		int s=0;
		int temp = 0;
		int[] amida = new int[w];
		for(int i = 0 ; i < w ; i ++)
			amida[i]=i+1;
		for(int i = 0 ; i < n ; i ++){
			c=br.readLine().split(",");
			f=Integer.parseInt(c[0]);
			s=Integer.parseInt(c[1]);
			temp=amida[f-1];
			amida[f-1]=amida[s-1];
			amida[s-1]=temp;
		}
		for(int i = 0;i<w;i++){
			System.out.println(amida[i]);
		}
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		String[] c = new String[2];
		int f=0;
		int s=0;
		int temp = 0;
		int[] amida = new int[w];
		for(int i = 0 ; i < w ; i ++)
			amida[i]=i+1;
		for(int i = 0 ; i < n ; i ++){
			c=br.readLine().split(",");
			f=Integer.parseInt(c[0]);
			s=Integer.parseInt(c[1]);
			temp=amida[f-1];
			amida[f-1]=amida[s-1];
			amida[s-1]=temp;
		}
		for(int i = 0;i<w;i++){
			System.out.println(amida[i]);
		}
	}
} Main
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		String[] c = new String[2];
		int f=0;
		int s=0;
		int temp = 0;
		int[] amida = new int[w];
		for(int i = 0 ; i < w ; i ++)
			amida[i]=i+1;
		for(int i = 0 ; i < n ; i ++){
			c=br.readLine().split(",");
			f=Integer.parseInt(c[0]);
			s=Integer.parseInt(c[1]);
			temp=amida[f-1];
			amida[f-1]=amida[s-1];
			amida[s-1]=temp;
		}
		for(int i = 0;i<w;i++){
			System.out.println(amida[i]);
		}
	}
}