import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int[] wArr=new int[w];
		for(int i=0;i<w;i++){
			wArr[i]=i+1;
		}
		for(int i=0;i<n;i++){
			String[] ab=sc.next().split(",");
			int a=Integer.parseInt(ab[0])-1;
			int b=Integer.parseInt(ab[1])-1;
			int box=wArr[a];
			wArr[a]=wArr[b];
			wArr[b]=box;
		}
		for(int i=0;i<w;i++){
			System.out.println(wArr[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int[] wArr=new int[w];
		for(int i=0;i<w;i++){
			wArr[i]=i+1;
		}
		for(int i=0;i<n;i++){
			String[] ab=sc.next().split(",");
			int a=Integer.parseInt(ab[0])-1;
			int b=Integer.parseInt(ab[1])-1;
			int box=wArr[a];
			wArr[a]=wArr[b];
			wArr[b]=box;
		}
		for(int i=0;i<w;i++){
			System.out.println(wArr[i]);
		}
	}
} Main public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int[] wArr=new int[w];
		for(int i=0;i<w;i++){
			wArr[i]=i+1;
		}
		for(int i=0;i<n;i++){
			String[] ab=sc.next().split(",");
			int a=Integer.parseInt(ab[0])-1;
			int b=Integer.parseInt(ab[1])-1;
			int box=wArr[a];
			wArr[a]=wArr[b];
			wArr[b]=box;
		}
		for(int i=0;i<w;i++){
			System.out.println(wArr[i]);
		}
	} main {
		Scanner sc=new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int[] wArr=new int[w];
		for(int i=0;i<w;i++){
			wArr[i]=i+1;
		}
		for(int i=0;i<n;i++){
			String[] ab=sc.next().split(",");
			int a=Integer.parseInt(ab[0])-1;
			int b=Integer.parseInt(ab[1])-1;
			int box=wArr[a];
			wArr[a]=wArr[b];
			wArr[b]=box;
		}
		for(int i=0;i<w;i++){
			System.out.println(wArr[i]);
		}
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int w=sc.nextInt(); w sc.nextInt() sc.nextInt sc int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] wArr=new int[w]; wArr new int[w] w for(int i=0;i<w;i++){
			wArr[i]=i+1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			wArr[i]=i+1;
		} {
			wArr[i]=i+1;
		} wArr[i]=i+1 wArr[i] wArr i i+1 i 1 for(int i=0;i<n;i++){
			String[] ab=sc.next().split(",");
			int a=Integer.parseInt(ab[0])-1;
			int b=Integer.parseInt(ab[1])-1;
			int box=wArr[a];
			wArr[a]=wArr[b];
			wArr[b]=box;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String[] ab=sc.next().split(",");
			int a=Integer.parseInt(ab[0])-1;
			int b=Integer.parseInt(ab[1])-1;
			int box=wArr[a];
			wArr[a]=wArr[b];
			wArr[b]=box;
		} {
			String[] ab=sc.next().split(",");
			int a=Integer.parseInt(ab[0])-1;
			int b=Integer.parseInt(ab[1])-1;
			int box=wArr[a];
			wArr[a]=wArr[b];
			wArr[b]=box;
		} String[] ab=sc.next().split(","); ab sc.next().split(",") sc.next().split sc.next() sc.next sc "," int a=Integer.parseInt(ab[0])-1; a Integer.parseInt(ab[0])-1 Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 1 int b=Integer.parseInt(ab[1])-1; b Integer.parseInt(ab[1])-1 Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 1 int box=wArr[a]; box wArr[a] wArr a wArr[a]=wArr[b] wArr[a] wArr a wArr[b] wArr b wArr[b]=box wArr[b] wArr b box for(int i=0;i<w;i++){
			System.out.println(wArr[i]);
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			System.out.println(wArr[i]);
		} {
			System.out.println(wArr[i]);
		} System.out.println(wArr[i]) System.out.println System.out System System.out wArr[i] wArr i String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int[] wArr=new int[w];
		for(int i=0;i<w;i++){
			wArr[i]=i+1;
		}
		for(int i=0;i<n;i++){
			String[] ab=sc.next().split(",");
			int a=Integer.parseInt(ab[0])-1;
			int b=Integer.parseInt(ab[1])-1;
			int box=wArr[a];
			wArr[a]=wArr[b];
			wArr[b]=box;
		}
		for(int i=0;i<w;i++){
			System.out.println(wArr[i]);
		}
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int[] wArr=new int[w];
		for(int i=0;i<w;i++){
			wArr[i]=i+1;
		}
		for(int i=0;i<n;i++){
			String[] ab=sc.next().split(",");
			int a=Integer.parseInt(ab[0])-1;
			int b=Integer.parseInt(ab[1])-1;
			int box=wArr[a];
			wArr[a]=wArr[b];
			wArr[b]=box;
		}
		for(int i=0;i<w;i++){
			System.out.println(wArr[i]);
		}
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int w=sc.nextInt();
		int n=sc.nextInt();
		int[] wArr=new int[w];
		for(int i=0;i<w;i++){
			wArr[i]=i+1;
		}
		for(int i=0;i<n;i++){
			String[] ab=sc.next().split(",");
			int a=Integer.parseInt(ab[0])-1;
			int b=Integer.parseInt(ab[1])-1;
			int box=wArr[a];
			wArr[a]=wArr[b];
			wArr[b]=box;
		}
		for(int i=0;i<w;i++){
			System.out.println(wArr[i]);
		}
	}
}