import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int w = scn.nextInt(), n = scn.nextInt();
		int[] ans = new int[w];
		for(int i = 1;i <= w;i++) {
			ans[i-1] = i;
		}
		int a,b,buf;
		String line = scn.nextLine();
		for(int i = 0;i < n;i++) {
			line = scn.nextLine();
			String[] nyan = line.split(",");
			a = Integer.parseInt(nyan[0])-1;
			b = Integer.parseInt(nyan[1])-1;
			buf = ans[a];
			ans[a] = ans[b];
			ans[b] = buf;
		}
		for(int i = 0;i < w;i++) {
			System.out.println(ans[i]);
		}
		scn.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int w = scn.nextInt(), n = scn.nextInt();
		int[] ans = new int[w];
		for(int i = 1;i <= w;i++) {
			ans[i-1] = i;
		}
		int a,b,buf;
		String line = scn.nextLine();
		for(int i = 0;i < n;i++) {
			line = scn.nextLine();
			String[] nyan = line.split(",");
			a = Integer.parseInt(nyan[0])-1;
			b = Integer.parseInt(nyan[1])-1;
			buf = ans[a];
			ans[a] = ans[b];
			ans[b] = buf;
		}
		for(int i = 0;i < w;i++) {
			System.out.println(ans[i]);
		}
		scn.close();
	}
} Main public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int w = scn.nextInt(), n = scn.nextInt();
		int[] ans = new int[w];
		for(int i = 1;i <= w;i++) {
			ans[i-1] = i;
		}
		int a,b,buf;
		String line = scn.nextLine();
		for(int i = 0;i < n;i++) {
			line = scn.nextLine();
			String[] nyan = line.split(",");
			a = Integer.parseInt(nyan[0])-1;
			b = Integer.parseInt(nyan[1])-1;
			buf = ans[a];
			ans[a] = ans[b];
			ans[b] = buf;
		}
		for(int i = 0;i < w;i++) {
			System.out.println(ans[i]);
		}
		scn.close();
	} main {
		Scanner scn = new Scanner(System.in);
		int w = scn.nextInt(), n = scn.nextInt();
		int[] ans = new int[w];
		for(int i = 1;i <= w;i++) {
			ans[i-1] = i;
		}
		int a,b,buf;
		String line = scn.nextLine();
		for(int i = 0;i < n;i++) {
			line = scn.nextLine();
			String[] nyan = line.split(",");
			a = Integer.parseInt(nyan[0])-1;
			b = Integer.parseInt(nyan[1])-1;
			buf = ans[a];
			ans[a] = ans[b];
			ans[b] = buf;
		}
		for(int i = 0;i < w;i++) {
			System.out.println(ans[i]);
		}
		scn.close();
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int w = scn.nextInt() w scn.nextInt() scn.nextInt scn n = scn.nextInt(); n scn.nextInt() scn.nextInt scn int[] ans = new int[w]; ans new int[w] w for(int i = 1;i <= w;i++) {
			ans[i-1] = i;
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			ans[i-1] = i;
		} {
			ans[i-1] = i;
		} ans[i-1] = i ans[i-1] ans i-1 i 1 i int a a b b buf; buf String line = scn.nextLine(); line scn.nextLine() scn.nextLine scn for(int i = 0;i < n;i++) {
			line = scn.nextLine();
			String[] nyan = line.split(",");
			a = Integer.parseInt(nyan[0])-1;
			b = Integer.parseInt(nyan[1])-1;
			buf = ans[a];
			ans[a] = ans[b];
			ans[b] = buf;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			line = scn.nextLine();
			String[] nyan = line.split(",");
			a = Integer.parseInt(nyan[0])-1;
			b = Integer.parseInt(nyan[1])-1;
			buf = ans[a];
			ans[a] = ans[b];
			ans[b] = buf;
		} {
			line = scn.nextLine();
			String[] nyan = line.split(",");
			a = Integer.parseInt(nyan[0])-1;
			b = Integer.parseInt(nyan[1])-1;
			buf = ans[a];
			ans[a] = ans[b];
			ans[b] = buf;
		} line = scn.nextLine() line scn.nextLine() scn.nextLine scn String[] nyan = line.split(","); nyan line.split(",") line.split line "," a = Integer.parseInt(nyan[0])-1 a Integer.parseInt(nyan[0])-1 Integer.parseInt(nyan[0]) Integer.parseInt Integer nyan[0] nyan 0 1 b = Integer.parseInt(nyan[1])-1 b Integer.parseInt(nyan[1])-1 Integer.parseInt(nyan[1]) Integer.parseInt Integer nyan[1] nyan 1 1 buf = ans[a] buf ans[a] ans a ans[a] = ans[b] ans[a] ans a ans[b] ans b ans[b] = buf ans[b] ans b buf for(int i = 0;i < w;i++) {
			System.out.println(ans[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(ans[i]);
		} {
			System.out.println(ans[i]);
		} System.out.println(ans[i]) System.out.println System.out System System.out ans[i] ans i scn.close() scn.close scn String args[] args public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int w = scn.nextInt(), n = scn.nextInt();
		int[] ans = new int[w];
		for(int i = 1;i <= w;i++) {
			ans[i-1] = i;
		}
		int a,b,buf;
		String line = scn.nextLine();
		for(int i = 0;i < n;i++) {
			line = scn.nextLine();
			String[] nyan = line.split(",");
			a = Integer.parseInt(nyan[0])-1;
			b = Integer.parseInt(nyan[1])-1;
			buf = ans[a];
			ans[a] = ans[b];
			ans[b] = buf;
		}
		for(int i = 0;i < w;i++) {
			System.out.println(ans[i]);
		}
		scn.close();
	}
} public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int w = scn.nextInt(), n = scn.nextInt();
		int[] ans = new int[w];
		for(int i = 1;i <= w;i++) {
			ans[i-1] = i;
		}
		int a,b,buf;
		String line = scn.nextLine();
		for(int i = 0;i < n;i++) {
			line = scn.nextLine();
			String[] nyan = line.split(",");
			a = Integer.parseInt(nyan[0])-1;
			b = Integer.parseInt(nyan[1])-1;
			buf = ans[a];
			ans[a] = ans[b];
			ans[b] = buf;
		}
		for(int i = 0;i < w;i++) {
			System.out.println(ans[i]);
		}
		scn.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int w = scn.nextInt(), n = scn.nextInt();
		int[] ans = new int[w];
		for(int i = 1;i <= w;i++) {
			ans[i-1] = i;
		}
		int a,b,buf;
		String line = scn.nextLine();
		for(int i = 0;i < n;i++) {
			line = scn.nextLine();
			String[] nyan = line.split(",");
			a = Integer.parseInt(nyan[0])-1;
			b = Integer.parseInt(nyan[1])-1;
			buf = ans[a];
			ans[a] = ans[b];
			ans[b] = buf;
		}
		for(int i = 0;i < w;i++) {
			System.out.println(ans[i]);
		}
		scn.close();
	}
}
