
import java.util.*;

class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		int w=sc.nextInt();
		int n=sc.nextInt();
		int [] data=new int[w+1];
		for(int i=1;i<=w;i++){
			data[i]=i;
		}
		
		for(int i=0;i<n;i++){
			String bar=sc.next();
			String[] bs=bar.split(",");
			int a1=Integer.parseInt(bs[0]);
			int a2=Integer.parseInt(bs[1]);
			int tmp=data[a1];
			data[a1]=data[a2];
			data[a2]=tmp;
		}
		
		for(int i=1;i<=w;i++){
			ln(data[i]);
		}
	}
	public static String join(double[] array, String separator) {
		StringBuilder str = new StringBuilder(array[0] + "");
		for (int i = 1; i < array.length; i++) {
			str.append(separator).append(array[i] + "");
		}
		return str.toString();
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
} import java.util.*; util.* java class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		int w=sc.nextInt();
		int n=sc.nextInt();
		int [] data=new int[w+1];
		for(int i=1;i<=w;i++){
			data[i]=i;
		}
		
		for(int i=0;i<n;i++){
			String bar=sc.next();
			String[] bs=bar.split(",");
			int a1=Integer.parseInt(bs[0]);
			int a2=Integer.parseInt(bs[1]);
			int tmp=data[a1];
			data[a1]=data[a2];
			data[a2]=tmp;
		}
		
		for(int i=1;i<=w;i++){
			ln(data[i]);
		}
	}
	public static String join(double[] array, String separator) {
		StringBuilder str = new StringBuilder(array[0] + "");
		for (int i = 1; i < array.length; i++) {
			str.append(separator).append(array[i] + "");
		}
		return str.toString();
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public void run() {
		int w=sc.nextInt();
		int n=sc.nextInt();
		int [] data=new int[w+1];
		for(int i=1;i<=w;i++){
			data[i]=i;
		}
		
		for(int i=0;i<n;i++){
			String bar=sc.next();
			String[] bs=bar.split(",");
			int a1=Integer.parseInt(bs[0]);
			int a2=Integer.parseInt(bs[1]);
			int tmp=data[a1];
			data[a1]=data[a2];
			data[a2]=tmp;
		}
		
		for(int i=1;i<=w;i++){
			ln(data[i]);
		}
	} run {
		int w=sc.nextInt();
		int n=sc.nextInt();
		int [] data=new int[w+1];
		for(int i=1;i<=w;i++){
			data[i]=i;
		}
		
		for(int i=0;i<n;i++){
			String bar=sc.next();
			String[] bs=bar.split(",");
			int a1=Integer.parseInt(bs[0]);
			int a2=Integer.parseInt(bs[1]);
			int tmp=data[a1];
			data[a1]=data[a2];
			data[a2]=tmp;
		}
		
		for(int i=1;i<=w;i++){
			ln(data[i]);
		}
	} int w=sc.nextInt(); w sc.nextInt() sc.nextInt sc int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int [] data=new int[w+1]; data new int[w+1] w+1 w 1 for(int i=1;i<=w;i++){
			data[i]=i;
		} int i=1; int i=1; i 1 i<=w i w i++ i++ i {
			data[i]=i;
		} {
			data[i]=i;
		} data[i]=i data[i] data i i for(int i=0;i<n;i++){
			String bar=sc.next();
			String[] bs=bar.split(",");
			int a1=Integer.parseInt(bs[0]);
			int a2=Integer.parseInt(bs[1]);
			int tmp=data[a1];
			data[a1]=data[a2];
			data[a2]=tmp;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String bar=sc.next();
			String[] bs=bar.split(",");
			int a1=Integer.parseInt(bs[0]);
			int a2=Integer.parseInt(bs[1]);
			int tmp=data[a1];
			data[a1]=data[a2];
			data[a2]=tmp;
		} {
			String bar=sc.next();
			String[] bs=bar.split(",");
			int a1=Integer.parseInt(bs[0]);
			int a2=Integer.parseInt(bs[1]);
			int tmp=data[a1];
			data[a1]=data[a2];
			data[a2]=tmp;
		} String bar=sc.next(); bar sc.next() sc.next sc String[] bs=bar.split(","); bs bar.split(",") bar.split bar "," int a1=Integer.parseInt(bs[0]); a1 Integer.parseInt(bs[0]) Integer.parseInt Integer bs[0] bs 0 int a2=Integer.parseInt(bs[1]); a2 Integer.parseInt(bs[1]) Integer.parseInt Integer bs[1] bs 1 int tmp=data[a1]; tmp data[a1] data a1 data[a1]=data[a2] data[a1] data a1 data[a2] data a2 data[a2]=tmp data[a2] data a2 tmp for(int i=1;i<=w;i++){
			ln(data[i]);
		} int i=1; int i=1; i 1 i<=w i w i++ i++ i {
			ln(data[i]);
		} {
			ln(data[i]);
		} ln(data[i]) ln data[i] data i public static String join(double[] array, String separator) {
		StringBuilder str = new StringBuilder(array[0] + "");
		for (int i = 1; i < array.length; i++) {
			str.append(separator).append(array[i] + "");
		}
		return str.toString();
	} join {
		StringBuilder str = new StringBuilder(array[0] + "");
		for (int i = 1; i < array.length; i++) {
			str.append(separator).append(array[i] + "");
		}
		return str.toString();
	} StringBuilder str = new StringBuilder(array[0] + ""); str new StringBuilder(array[0] + "") for (int i = 1; i < array.length; i++) {
			str.append(separator).append(array[i] + "");
		} int i = 1; int i = 1; i 1 i < array.length i array.length array array.length i++ i++ i {
			str.append(separator).append(array[i] + "");
		} {
			str.append(separator).append(array[i] + "");
		} str.append(separator).append(array[i] + "") str.append(separator).append str.append(separator) str.append str separator array[i] + "" array[i] array i "" return str.toString(); str.toString() str.toString str double[] array array String separator separator public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public static void pr(Object o) {
		System.out.print(o);
	} pr {
		System.out.print(o);
	} System.out.print(o) System.out.print System.out System System.out o Object o o public static void ln(Object o) {
		System.out.println(o);
	} ln {
		System.out.println(o);
	} System.out.println(o) System.out.println System.out System System.out o Object o o public static void ln() {
		System.out.println();
	} ln {
		System.out.println();
	} System.out.println() System.out.println System.out System System.out

import java.util.*;

class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		int w=sc.nextInt();
		int n=sc.nextInt();
		int [] data=new int[w+1];
		for(int i=1;i<=w;i++){
			data[i]=i;
		}
		
		for(int i=0;i<n;i++){
			String bar=sc.next();
			String[] bs=bar.split(",");
			int a1=Integer.parseInt(bs[0]);
			int a2=Integer.parseInt(bs[1]);
			int tmp=data[a1];
			data[a1]=data[a2];
			data[a2]=tmp;
		}
		
		for(int i=1;i<=w;i++){
			ln(data[i]);
		}
	}
	public static String join(double[] array, String separator) {
		StringBuilder str = new StringBuilder(array[0] + "");
		for (int i = 1; i < array.length; i++) {
			str.append(separator).append(array[i] + "");
		}
		return str.toString();
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}