import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] lot_num = new int[w];
		int n = sc.nextInt();
		int a,b,swap;
		String str;

		for(int i=0; i<w; i++){
			lot_num[i] = i+1;
		}
		
		for(int i=0; i<n; i++){
			str = sc.next();
			String[] num = str.split(",");
 			a = Integer.parseInt(num[0]);
			b = Integer.parseInt(num[1]);
			swap = lot_num[a-1];
			lot_num[a-1] = lot_num[b-1];
			lot_num[b-1] = swap;
		}

		for(int i=0; i<w; i++){
			System.out.println(lot_num[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[] lot_num = new int[w];
		int n = sc.nextInt();
		int a,b,swap;
		String str;

		for(int i=0; i<w; i++){
			lot_num[i] = i+1;
		}
		
		for(int i=0; i<n; i++){
			str = sc.next();
			String[] num = str.split(",");
 			a = Integer.parseInt(num[0]);
			b = Integer.parseInt(num[1]);
			swap = lot_num[a-1];
			lot_num[a-1] = lot_num[b-1];
			lot_num[b-1] = swap;
		}

		for(int i=0; i<w; i++){
			System.out.println(lot_num[i]);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] lot_num = new int[w];
		int n = sc.nextInt();
		int a,b,swap;
		String str;

		for(int i=0; i<w; i++){
			lot_num[i] = i+1;
		}
		
		for(int i=0; i<n; i++){
			str = sc.next();
			String[] num = str.split(",");
 			a = Integer.parseInt(num[0]);
			b = Integer.parseInt(num[1]);
			swap = lot_num[a-1];
			lot_num[a-1] = lot_num[b-1];
			lot_num[b-1] = swap;
		}

		for(int i=0; i<w; i++){
			System.out.println(lot_num[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] lot_num = new int[w];
		int n = sc.nextInt();
		int a,b,swap;
		String str;

		for(int i=0; i<w; i++){
			lot_num[i] = i+1;
		}
		
		for(int i=0; i<n; i++){
			str = sc.next();
			String[] num = str.split(",");
 			a = Integer.parseInt(num[0]);
			b = Integer.parseInt(num[1]);
			swap = lot_num[a-1];
			lot_num[a-1] = lot_num[b-1];
			lot_num[b-1] = swap;
		}

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

		for(int i=0; i<w; i++){
			lot_num[i] = i+1;
		}
		
		for(int i=0; i<n; i++){
			str = sc.next();
			String[] num = str.split(",");
 			a = Integer.parseInt(num[0]);
			b = Integer.parseInt(num[1]);
			swap = lot_num[a-1];
			lot_num[a-1] = lot_num[b-1];
			lot_num[b-1] = swap;
		}

		for(int i=0; i<w; i++){
			System.out.println(lot_num[i]);
		}
	}
} public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int[] lot_num = new int[w];
		int n = sc.nextInt();
		int a,b,swap;
		String str;

		for(int i=0; i<w; i++){
			lot_num[i] = i+1;
		}
		
		for(int i=0; i<n; i++){
			str = sc.next();
			String[] num = str.split(",");
 			a = Integer.parseInt(num[0]);
			b = Integer.parseInt(num[1]);
			swap = lot_num[a-1];
			lot_num[a-1] = lot_num[b-1];
			lot_num[b-1] = swap;
		}

		for(int i=0; i<w; i++){
			System.out.println(lot_num[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[] lot_num = new int[w];
		int n = sc.nextInt();
		int a,b,swap;
		String str;

		for(int i=0; i<w; i++){
			lot_num[i] = i+1;
		}
		
		for(int i=0; i<n; i++){
			str = sc.next();
			String[] num = str.split(",");
 			a = Integer.parseInt(num[0]);
			b = Integer.parseInt(num[1]);
			swap = lot_num[a-1];
			lot_num[a-1] = lot_num[b-1];
			lot_num[b-1] = swap;
		}

		for(int i=0; i<w; i++){
			System.out.println(lot_num[i]);
		}
	}
}