import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] ret = new int[w+1];
		for(int i =0 ; i < w+1; i++) ret[i] = i;
		for(int k = 0;  k< n ; k++){
			String ts = sc.next();
			ts = ts.replace(',', ' ');
			Scanner str = new Scanner(ts);
			int d1 =str.nextInt();
			int d2 =str.nextInt();
			int temp = ret[d1];
			ret[d1] = ret[d2];
			ret[d2] = temp;
		}
		for(int i = 1;i < w+1;i++){
			System.out.println(ret[i]);
		}
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
		
	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.math.*; math.* java public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] ret = new int[w+1];
		for(int i =0 ; i < w+1; i++) ret[i] = i;
		for(int k = 0;  k< n ; k++){
			String ts = sc.next();
			ts = ts.replace(',', ' ');
			Scanner str = new Scanner(ts);
			int d1 =str.nextInt();
			int d2 =str.nextInt();
			int temp = ret[d1];
			ret[d1] = ret[d2];
			ret[d2] = temp;
		}
		for(int i = 1;i < w+1;i++){
			System.out.println(ret[i]);
		}
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
		
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) void run(){
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] ret = new int[w+1];
		for(int i =0 ; i < w+1; i++) ret[i] = i;
		for(int k = 0;  k< n ; k++){
			String ts = sc.next();
			ts = ts.replace(',', ' ');
			Scanner str = new Scanner(ts);
			int d1 =str.nextInt();
			int d2 =str.nextInt();
			int temp = ret[d1];
			ret[d1] = ret[d2];
			ret[d2] = temp;
		}
		for(int i = 1;i < w+1;i++){
			System.out.println(ret[i]);
		}
	} run {
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] ret = new int[w+1];
		for(int i =0 ; i < w+1; i++) ret[i] = i;
		for(int k = 0;  k< n ; k++){
			String ts = sc.next();
			ts = ts.replace(',', ' ');
			Scanner str = new Scanner(ts);
			int d1 =str.nextInt();
			int d2 =str.nextInt();
			int temp = ret[d1];
			ret[d1] = ret[d2];
			ret[d2] = temp;
		}
		for(int i = 1;i < w+1;i++){
			System.out.println(ret[i]);
		}
	} int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] ret = new int[w+1]; ret new int[w+1] w+1 w 1 for(int i =0 ; i < w+1; i++) ret[i] = i; int i =0 ; int i =0 ; i 0 i < w+1 i w+1 w 1 i++ i++ i ret[i] = i; ret[i] = i ret[i] ret i i for(int k = 0;  k< n ; k++){
			String ts = sc.next();
			ts = ts.replace(',', ' ');
			Scanner str = new Scanner(ts);
			int d1 =str.nextInt();
			int d2 =str.nextInt();
			int temp = ret[d1];
			ret[d1] = ret[d2];
			ret[d2] = temp;
		} int k = 0; int k = 0; k 0 k< n k n k++ k++ k {
			String ts = sc.next();
			ts = ts.replace(',', ' ');
			Scanner str = new Scanner(ts);
			int d1 =str.nextInt();
			int d2 =str.nextInt();
			int temp = ret[d1];
			ret[d1] = ret[d2];
			ret[d2] = temp;
		} {
			String ts = sc.next();
			ts = ts.replace(',', ' ');
			Scanner str = new Scanner(ts);
			int d1 =str.nextInt();
			int d2 =str.nextInt();
			int temp = ret[d1];
			ret[d1] = ret[d2];
			ret[d2] = temp;
		} String ts = sc.next(); ts sc.next() sc.next sc ts = ts.replace(',', ' ') ts ts.replace(',', ' ') ts.replace ts ',' ' ' Scanner str = new Scanner(ts); str new Scanner(ts) int d1 =str.nextInt(); d1 str.nextInt() str.nextInt str int d2 =str.nextInt(); d2 str.nextInt() str.nextInt str int temp = ret[d1]; temp ret[d1] ret d1 ret[d1] = ret[d2] ret[d1] ret d1 ret[d2] ret d2 ret[d2] = temp ret[d2] ret d2 temp for(int i = 1;i < w+1;i++){
			System.out.println(ret[i]);
		} int i = 1; int i = 1; i 1 i < w+1 i w+1 w 1 i++ i++ i {
			System.out.println(ret[i]);
		} {
			System.out.println(ret[i]);
		} System.out.println(ret[i]) System.out.println System.out System System.out ret[i] ret i public static void main(String[] args){
		Main m = new Main();
		m.run();
		
	} main {
		Main m = new Main();
		m.run();
		
	} Main m = new Main(); m new Main() m.run() m.run m String[] args args public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] ret = new int[w+1];
		for(int i =0 ; i < w+1; i++) ret[i] = i;
		for(int k = 0;  k< n ; k++){
			String ts = sc.next();
			ts = ts.replace(',', ' ');
			Scanner str = new Scanner(ts);
			int d1 =str.nextInt();
			int d2 =str.nextInt();
			int temp = ret[d1];
			ret[d1] = ret[d2];
			ret[d2] = temp;
		}
		for(int i = 1;i < w+1;i++){
			System.out.println(ret[i]);
		}
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
		
	}
} public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] ret = new int[w+1];
		for(int i =0 ; i < w+1; i++) ret[i] = i;
		for(int k = 0;  k< n ; k++){
			String ts = sc.next();
			ts = ts.replace(',', ' ');
			Scanner str = new Scanner(ts);
			int d1 =str.nextInt();
			int d2 =str.nextInt();
			int temp = ret[d1];
			ret[d1] = ret[d2];
			ret[d2] = temp;
		}
		for(int i = 1;i < w+1;i++){
			System.out.println(ret[i]);
		}
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
		
	}
} Main
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] ret = new int[w+1];
		for(int i =0 ; i < w+1; i++) ret[i] = i;
		for(int k = 0;  k< n ; k++){
			String ts = sc.next();
			ts = ts.replace(',', ' ');
			Scanner str = new Scanner(ts);
			int d1 =str.nextInt();
			int d2 =str.nextInt();
			int temp = ret[d1];
			ret[d1] = ret[d2];
			ret[d2] = temp;
		}
		for(int i = 1;i < w+1;i++){
			System.out.println(ret[i]);
		}
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
		
	}
}