import java.util.Scanner;


public class Main{

	static Scanner sc = new Scanner(System.in);
	
	static int tmp, n, w, com;
	static String str[];
	static int a[] = new int[30], b[] = new int[30], line[] = new int[30];
	
	public static void main(String[] args) {
		
		while(read()){
			solve();
		}

	}
	
	public static boolean read(){
		if(!sc.hasNext()) return false;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		for(int i = 0; i < n; i++){
			str = sc.next().split(",");
			
			a[i] = Integer.parseInt(str[0]);
			b[i] = Integer.parseInt(str[1]);
		}
		
		return true;
	}
	
	public static void solve(){
		
		for(int i = 0; i < w; i++){
			line[i] = i + 1;
		}
		
		for(int i = 0; i < n; i++){
			tmp = line[a[i]-1];
			line[a[i]-1] = line[b[i]-1];
			line[b[i]-1] = tmp;
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(line[i]);
		}
	}

} import java.util.Scanner; Scanner java.util public class Main{

	static Scanner sc = new Scanner(System.in);
	
	static int tmp, n, w, com;
	static String str[];
	static int a[] = new int[30], b[] = new int[30], line[] = new int[30];
	
	public static void main(String[] args) {
		
		while(read()){
			solve();
		}

	}
	
	public static boolean read(){
		if(!sc.hasNext()) return false;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		for(int i = 0; i < n; i++){
			str = sc.next().split(",");
			
			a[i] = Integer.parseInt(str[0]);
			b[i] = Integer.parseInt(str[1]);
		}
		
		return true;
	}
	
	public static void solve(){
		
		for(int i = 0; i < w; i++){
			line[i] = i + 1;
		}
		
		for(int i = 0; i < n; i++){
			tmp = line[a[i]-1];
			line[a[i]-1] = line[b[i]-1];
			line[b[i]-1] = tmp;
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(line[i]);
		}
	}

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static int tmp tmp n n w w com; com static String str[]; str static int a[] = new int[30] a new int[30] 30 b[] = new int[30] b new int[30] 30 line[] = new int[30]; line new int[30] 30 public static void main(String[] args) {
		
		while(read()){
			solve();
		}

	} main {
		
		while(read()){
			solve();
		}

	} while(read()){
			solve();
		} read() read {
			solve();
		} solve() solve String[] args args public static boolean read(){
		if(!sc.hasNext()) return false;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		for(int i = 0; i < n; i++){
			str = sc.next().split(",");
			
			a[i] = Integer.parseInt(str[0]);
			b[i] = Integer.parseInt(str[1]);
		}
		
		return true;
	} read {
		if(!sc.hasNext()) return false;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		for(int i = 0; i < n; i++){
			str = sc.next().split(",");
			
			a[i] = Integer.parseInt(str[0]);
			b[i] = Integer.parseInt(str[1]);
		}
		
		return true;
	} if(!sc.hasNext()) return false; !sc.hasNext() sc.hasNext() sc.hasNext sc return false; false w = sc.nextInt() w sc.nextInt() sc.nextInt sc n = sc.nextInt() n sc.nextInt() sc.nextInt sc for(int i = 0; i < n; i++){
			str = sc.next().split(",");
			
			a[i] = Integer.parseInt(str[0]);
			b[i] = Integer.parseInt(str[1]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			str = sc.next().split(",");
			
			a[i] = Integer.parseInt(str[0]);
			b[i] = Integer.parseInt(str[1]);
		} {
			str = sc.next().split(",");
			
			a[i] = Integer.parseInt(str[0]);
			b[i] = Integer.parseInt(str[1]);
		} str = sc.next().split(",") str sc.next().split(",") sc.next().split sc.next() sc.next sc "," a[i] = Integer.parseInt(str[0]) a[i] a i Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 b[i] = Integer.parseInt(str[1]) b[i] b i Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 return true; true public static void solve(){
		
		for(int i = 0; i < w; i++){
			line[i] = i + 1;
		}
		
		for(int i = 0; i < n; i++){
			tmp = line[a[i]-1];
			line[a[i]-1] = line[b[i]-1];
			line[b[i]-1] = tmp;
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(line[i]);
		}
	} solve {
		
		for(int i = 0; i < w; i++){
			line[i] = i + 1;
		}
		
		for(int i = 0; i < n; i++){
			tmp = line[a[i]-1];
			line[a[i]-1] = line[b[i]-1];
			line[b[i]-1] = tmp;
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(line[i]);
		}
	} for(int i = 0; i < w; i++){
			line[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			line[i] = i + 1;
		} {
			line[i] = i + 1;
		} line[i] = i + 1 line[i] line i i + 1 i 1 for(int i = 0; i < n; i++){
			tmp = line[a[i]-1];
			line[a[i]-1] = line[b[i]-1];
			line[b[i]-1] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			tmp = line[a[i]-1];
			line[a[i]-1] = line[b[i]-1];
			line[b[i]-1] = tmp;
		} {
			tmp = line[a[i]-1];
			line[a[i]-1] = line[b[i]-1];
			line[b[i]-1] = tmp;
		} tmp = line[a[i]-1] tmp line[a[i]-1] line a[i]-1 a[i] a i 1 line[a[i]-1] = line[b[i]-1] line[a[i]-1] line a[i]-1 a[i] a i 1 line[b[i]-1] line b[i]-1 b[i] b i 1 line[b[i]-1] = tmp line[b[i]-1] line b[i]-1 b[i] b i 1 tmp for(int i = 0; i < w; i++){
			System.out.println(line[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(line[i]);
		} {
			System.out.println(line[i]);
		} System.out.println(line[i]) System.out.println System.out System System.out line[i] line i public class Main{

	static Scanner sc = new Scanner(System.in);
	
	static int tmp, n, w, com;
	static String str[];
	static int a[] = new int[30], b[] = new int[30], line[] = new int[30];
	
	public static void main(String[] args) {
		
		while(read()){
			solve();
		}

	}
	
	public static boolean read(){
		if(!sc.hasNext()) return false;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		for(int i = 0; i < n; i++){
			str = sc.next().split(",");
			
			a[i] = Integer.parseInt(str[0]);
			b[i] = Integer.parseInt(str[1]);
		}
		
		return true;
	}
	
	public static void solve(){
		
		for(int i = 0; i < w; i++){
			line[i] = i + 1;
		}
		
		for(int i = 0; i < n; i++){
			tmp = line[a[i]-1];
			line[a[i]-1] = line[b[i]-1];
			line[b[i]-1] = tmp;
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(line[i]);
		}
	}

} public class Main{

	static Scanner sc = new Scanner(System.in);
	
	static int tmp, n, w, com;
	static String str[];
	static int a[] = new int[30], b[] = new int[30], line[] = new int[30];
	
	public static void main(String[] args) {
		
		while(read()){
			solve();
		}

	}
	
	public static boolean read(){
		if(!sc.hasNext()) return false;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		for(int i = 0; i < n; i++){
			str = sc.next().split(",");
			
			a[i] = Integer.parseInt(str[0]);
			b[i] = Integer.parseInt(str[1]);
		}
		
		return true;
	}
	
	public static void solve(){
		
		for(int i = 0; i < w; i++){
			line[i] = i + 1;
		}
		
		for(int i = 0; i < n; i++){
			tmp = line[a[i]-1];
			line[a[i]-1] = line[b[i]-1];
			line[b[i]-1] = tmp;
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(line[i]);
		}
	}

} Main
import java.util.Scanner;


public class Main{

	static Scanner sc = new Scanner(System.in);
	
	static int tmp, n, w, com;
	static String str[];
	static int a[] = new int[30], b[] = new int[30], line[] = new int[30];
	
	public static void main(String[] args) {
		
		while(read()){
			solve();
		}

	}
	
	public static boolean read(){
		if(!sc.hasNext()) return false;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		for(int i = 0; i < n; i++){
			str = sc.next().split(",");
			
			a[i] = Integer.parseInt(str[0]);
			b[i] = Integer.parseInt(str[1]);
		}
		
		return true;
	}
	
	public static void solve(){
		
		for(int i = 0; i < w; i++){
			line[i] = i + 1;
		}
		
		for(int i = 0; i < n; i++){
			tmp = line[a[i]-1];
			line[a[i]-1] = line[b[i]-1];
			line[b[i]-1] = tmp;
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(line[i]);
		}
	}

}