import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sousuu = sc.nextInt(),henkan_suu = sc.nextInt();
		int[] jyun = new int[sousuu];
		for(int i=0;i<sousuu;i++) jyun[i]=i+1;

		for(int i=0;i<henkan_suu;i++){
			String s = sc.next();
			String[] ab = s.split(",");
			int ichi = Integer.parseInt(ab[0])-1;
			int ni   = Integer.parseInt(ab[1])-1;
			int temp = jyun[ichi];
			jyun[ichi] = jyun[ni];
			jyun[ni] = temp;
		}

		for(int i=0;i<sousuu;i++){
			System.out.println(jyun[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sousuu = sc.nextInt(),henkan_suu = sc.nextInt();
		int[] jyun = new int[sousuu];
		for(int i=0;i<sousuu;i++) jyun[i]=i+1;

		for(int i=0;i<henkan_suu;i++){
			String s = sc.next();
			String[] ab = s.split(",");
			int ichi = Integer.parseInt(ab[0])-1;
			int ni   = Integer.parseInt(ab[1])-1;
			int temp = jyun[ichi];
			jyun[ichi] = jyun[ni];
			jyun[ni] = temp;
		}

		for(int i=0;i<sousuu;i++){
			System.out.println(jyun[i]);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sousuu = sc.nextInt(),henkan_suu = sc.nextInt();
		int[] jyun = new int[sousuu];
		for(int i=0;i<sousuu;i++) jyun[i]=i+1;

		for(int i=0;i<henkan_suu;i++){
			String s = sc.next();
			String[] ab = s.split(",");
			int ichi = Integer.parseInt(ab[0])-1;
			int ni   = Integer.parseInt(ab[1])-1;
			int temp = jyun[ichi];
			jyun[ichi] = jyun[ni];
			jyun[ni] = temp;
		}

		for(int i=0;i<sousuu;i++){
			System.out.println(jyun[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int sousuu = sc.nextInt(),henkan_suu = sc.nextInt();
		int[] jyun = new int[sousuu];
		for(int i=0;i<sousuu;i++) jyun[i]=i+1;

		for(int i=0;i<henkan_suu;i++){
			String s = sc.next();
			String[] ab = s.split(",");
			int ichi = Integer.parseInt(ab[0])-1;
			int ni   = Integer.parseInt(ab[1])-1;
			int temp = jyun[ichi];
			jyun[ichi] = jyun[ni];
			jyun[ni] = temp;
		}

		for(int i=0;i<sousuu;i++){
			System.out.println(jyun[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int sousuu = sc.nextInt() sousuu sc.nextInt() sc.nextInt sc henkan_suu = sc.nextInt(); henkan_suu sc.nextInt() sc.nextInt sc int[] jyun = new int[sousuu]; jyun new int[sousuu] sousuu for(int i=0;i<sousuu;i++) jyun[i]=i+1; int i=0; int i=0; i 0 i<sousuu i sousuu i++ i++ i jyun[i]=i+1; jyun[i]=i+1 jyun[i] jyun i i+1 i 1 for(int i=0;i<henkan_suu;i++){
			String s = sc.next();
			String[] ab = s.split(",");
			int ichi = Integer.parseInt(ab[0])-1;
			int ni   = Integer.parseInt(ab[1])-1;
			int temp = jyun[ichi];
			jyun[ichi] = jyun[ni];
			jyun[ni] = temp;
		} int i=0; int i=0; i 0 i<henkan_suu i henkan_suu i++ i++ i {
			String s = sc.next();
			String[] ab = s.split(",");
			int ichi = Integer.parseInt(ab[0])-1;
			int ni   = Integer.parseInt(ab[1])-1;
			int temp = jyun[ichi];
			jyun[ichi] = jyun[ni];
			jyun[ni] = temp;
		} {
			String s = sc.next();
			String[] ab = s.split(",");
			int ichi = Integer.parseInt(ab[0])-1;
			int ni   = Integer.parseInt(ab[1])-1;
			int temp = jyun[ichi];
			jyun[ichi] = jyun[ni];
			jyun[ni] = temp;
		} String s = sc.next(); s sc.next() sc.next sc String[] ab = s.split(","); ab s.split(",") s.split s "," int ichi = Integer.parseInt(ab[0])-1; ichi Integer.parseInt(ab[0])-1 Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 1 int ni   = Integer.parseInt(ab[1])-1; ni Integer.parseInt(ab[1])-1 Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 1 int temp = jyun[ichi]; temp jyun[ichi] jyun ichi jyun[ichi] = jyun[ni] jyun[ichi] jyun ichi jyun[ni] jyun ni jyun[ni] = temp jyun[ni] jyun ni temp for(int i=0;i<sousuu;i++){
			System.out.println(jyun[i]);
		} int i=0; int i=0; i 0 i<sousuu i sousuu i++ i++ i {
			System.out.println(jyun[i]);
		} {
			System.out.println(jyun[i]);
		} System.out.println(jyun[i]) System.out.println System.out System System.out jyun[i] jyun i String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sousuu = sc.nextInt(),henkan_suu = sc.nextInt();
		int[] jyun = new int[sousuu];
		for(int i=0;i<sousuu;i++) jyun[i]=i+1;

		for(int i=0;i<henkan_suu;i++){
			String s = sc.next();
			String[] ab = s.split(",");
			int ichi = Integer.parseInt(ab[0])-1;
			int ni   = Integer.parseInt(ab[1])-1;
			int temp = jyun[ichi];
			jyun[ichi] = jyun[ni];
			jyun[ni] = temp;
		}

		for(int i=0;i<sousuu;i++){
			System.out.println(jyun[i]);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sousuu = sc.nextInt(),henkan_suu = sc.nextInt();
		int[] jyun = new int[sousuu];
		for(int i=0;i<sousuu;i++) jyun[i]=i+1;

		for(int i=0;i<henkan_suu;i++){
			String s = sc.next();
			String[] ab = s.split(",");
			int ichi = Integer.parseInt(ab[0])-1;
			int ni   = Integer.parseInt(ab[1])-1;
			int temp = jyun[ichi];
			jyun[ichi] = jyun[ni];
			jyun[ni] = temp;
		}

		for(int i=0;i<sousuu;i++){
			System.out.println(jyun[i]);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sousuu = sc.nextInt(),henkan_suu = sc.nextInt();
		int[] jyun = new int[sousuu];
		for(int i=0;i<sousuu;i++) jyun[i]=i+1;

		for(int i=0;i<henkan_suu;i++){
			String s = sc.next();
			String[] ab = s.split(",");
			int ichi = Integer.parseInt(ab[0])-1;
			int ni   = Integer.parseInt(ab[1])-1;
			int temp = jyun[ichi];
			jyun[ichi] = jyun[ni];
			jyun[ni] = temp;
		}

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