import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w;
		int n;
		int a,b;
		short tmp;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		int[] data = new int[w];
		
		for(int i=0;i<w;i++){
			data[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] str = sc.next().split(",");
			data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1]));
		}
		sc.close();
		for(int i=0;i<w;i++){
			System.out.println(data[i]);
		}
	}
	
	static int[] swap(int[] dat,int a,int b){
		int temp;
		
		--a;
		--b;
		
		temp = dat[a];
		dat[a] = dat[b];
		dat[b] = temp;
		
		return dat;
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w;
		int n;
		int a,b;
		short tmp;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		int[] data = new int[w];
		
		for(int i=0;i<w;i++){
			data[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] str = sc.next().split(",");
			data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1]));
		}
		sc.close();
		for(int i=0;i<w;i++){
			System.out.println(data[i]);
		}
	}
	
	static int[] swap(int[] dat,int a,int b){
		int temp;
		
		--a;
		--b;
		
		temp = dat[a];
		dat[a] = dat[b];
		dat[b] = temp;
		
		return dat;
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w;
		int n;
		int a,b;
		short tmp;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		int[] data = new int[w];
		
		for(int i=0;i<w;i++){
			data[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] str = sc.next().split(",");
			data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1]));
		}
		sc.close();
		for(int i=0;i<w;i++){
			System.out.println(data[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int w;
		int n;
		int a,b;
		short tmp;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		int[] data = new int[w];
		
		for(int i=0;i<w;i++){
			data[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] str = sc.next().split(",");
			data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1]));
		}
		sc.close();
		for(int i=0;i<w;i++){
			System.out.println(data[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w; w int n; n int a a b; b short tmp; tmp w = sc.nextInt() w sc.nextInt() sc.nextInt sc n = sc.nextInt() n sc.nextInt() sc.nextInt sc int[] data = new int[w]; data new int[w] w for(int i=0;i<w;i++){
			data[i] = i+1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			data[i] = i+1;
		} {
			data[i] = i+1;
		} data[i] = i+1 data[i] data i i+1 i 1 for(int i=0;i<n;i++){
			String[] str = sc.next().split(",");
			data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1]));
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String[] str = sc.next().split(",");
			data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1]));
		} {
			String[] str = sc.next().split(",");
			data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1]));
		} String[] str = sc.next().split(","); str sc.next().split(",") sc.next().split sc.next() sc.next sc "," data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1])) data swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1])) swap data Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 sc.close() sc.close sc for(int i=0;i<w;i++){
			System.out.println(data[i]);
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			System.out.println(data[i]);
		} {
			System.out.println(data[i]);
		} System.out.println(data[i]) System.out.println System.out System System.out data[i] data i String[] args args static int[] swap(int[] dat,int a,int b){
		int temp;
		
		--a;
		--b;
		
		temp = dat[a];
		dat[a] = dat[b];
		dat[b] = temp;
		
		return dat;
	} swap {
		int temp;
		
		--a;
		--b;
		
		temp = dat[a];
		dat[a] = dat[b];
		dat[b] = temp;
		
		return dat;
	} int temp; temp --a a --b b temp = dat[a] temp dat[a] dat a dat[a] = dat[b] dat[a] dat a dat[b] dat b dat[b] = temp dat[b] dat b temp return dat; dat int[] dat dat int a a int b b public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w;
		int n;
		int a,b;
		short tmp;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		int[] data = new int[w];
		
		for(int i=0;i<w;i++){
			data[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] str = sc.next().split(",");
			data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1]));
		}
		sc.close();
		for(int i=0;i<w;i++){
			System.out.println(data[i]);
		}
	}
	
	static int[] swap(int[] dat,int a,int b){
		int temp;
		
		--a;
		--b;
		
		temp = dat[a];
		dat[a] = dat[b];
		dat[b] = temp;
		
		return dat;
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w;
		int n;
		int a,b;
		short tmp;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		int[] data = new int[w];
		
		for(int i=0;i<w;i++){
			data[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] str = sc.next().split(",");
			data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1]));
		}
		sc.close();
		for(int i=0;i<w;i++){
			System.out.println(data[i]);
		}
	}
	
	static int[] swap(int[] dat,int a,int b){
		int temp;
		
		--a;
		--b;
		
		temp = dat[a];
		dat[a] = dat[b];
		dat[b] = temp;
		
		return dat;
	}
} Main
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w;
		int n;
		int a,b;
		short tmp;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		int[] data = new int[w];
		
		for(int i=0;i<w;i++){
			data[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] str = sc.next().split(",");
			data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1]));
		}
		sc.close();
		for(int i=0;i<w;i++){
			System.out.println(data[i]);
		}
	}
	
	static int[] swap(int[] dat,int a,int b){
		int temp;
		
		--a;
		--b;
		
		temp = dat[a];
		dat[a] = dat[b];
		dat[b] = temp;
		
		return dat;
	}
}