import java.util.Scanner;

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

public class Main {
    
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int w = s.nextInt();
		int n = s.nextInt();
		String[] in = new String[2];
		int[] out = new int[w+1];
		int temp;
		for(int i=0 ; i<=w ; i++)
			out[i] = i;
		for(int i=0 ; i<n ; i++){
			in = s.next().split(",");
			temp = out[Integer.parseInt(in[0])];
			out[Integer.parseInt(in[0])] = out[Integer.parseInt(in[1])];
			out[Integer.parseInt(in[1])] = temp;
		}
		for(int i=1 ; i<=w ; i++)
			System.out.println(out[i]);
    }
}