import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] row = new int[sc.nextInt()];
		for(int i = 0; i < row.length; i++){
			row[i] = i + 1;
		}
		int ctimes = sc.nextInt();
	
		sc.nextLine();
		for(int j = 0; j < ctimes; j++){
			int[] ch = new int[2];
			String[] s = sc.nextLine().split(",");
			ch[0] = Integer.parseInt(s[0]) -1;
			ch[1] = Integer.parseInt(s[1]) -1;
			
			int temp = row[ch[0]];
			row[ch[0]] = row[ch[1]];
			row[ch[1]] = temp;
		}

		for(int i = 0; i < row.length; i++){
			System.out.println(row[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] row = new int[sc.nextInt()];
		for(int i = 0; i < row.length; i++){
			row[i] = i + 1;
		}
		int ctimes = sc.nextInt();
	
		sc.nextLine();
		for(int j = 0; j < ctimes; j++){
			int[] ch = new int[2];
			String[] s = sc.nextLine().split(",");
			ch[0] = Integer.parseInt(s[0]) -1;
			ch[1] = Integer.parseInt(s[1]) -1;
			
			int temp = row[ch[0]];
			row[ch[0]] = row[ch[1]];
			row[ch[1]] = temp;
		}

		for(int i = 0; i < row.length; i++){
			System.out.println(row[i]);
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] row = new int[sc.nextInt()];
		for(int i = 0; i < row.length; i++){
			row[i] = i + 1;
		}
		int ctimes = sc.nextInt();
	
		sc.nextLine();
		for(int j = 0; j < ctimes; j++){
			int[] ch = new int[2];
			String[] s = sc.nextLine().split(",");
			ch[0] = Integer.parseInt(s[0]) -1;
			ch[1] = Integer.parseInt(s[1]) -1;
			
			int temp = row[ch[0]];
			row[ch[0]] = row[ch[1]];
			row[ch[1]] = temp;
		}

		for(int i = 0; i < row.length; i++){
			System.out.println(row[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int[] row = new int[sc.nextInt()];
		for(int i = 0; i < row.length; i++){
			row[i] = i + 1;
		}
		int ctimes = sc.nextInt();
	
		sc.nextLine();
		for(int j = 0; j < ctimes; j++){
			int[] ch = new int[2];
			String[] s = sc.nextLine().split(",");
			ch[0] = Integer.parseInt(s[0]) -1;
			ch[1] = Integer.parseInt(s[1]) -1;
			
			int temp = row[ch[0]];
			row[ch[0]] = row[ch[1]];
			row[ch[1]] = temp;
		}

		for(int i = 0; i < row.length; i++){
			System.out.println(row[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] row = new int[sc.nextInt()]; row new int[sc.nextInt()] sc.nextInt() sc.nextInt sc for(int i = 0; i < row.length; i++){
			row[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < row.length i row.length row row.length i++ i++ i {
			row[i] = i + 1;
		} {
			row[i] = i + 1;
		} row[i] = i + 1 row[i] row i i + 1 i 1 int ctimes = sc.nextInt(); ctimes sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc for(int j = 0; j < ctimes; j++){
			int[] ch = new int[2];
			String[] s = sc.nextLine().split(",");
			ch[0] = Integer.parseInt(s[0]) -1;
			ch[1] = Integer.parseInt(s[1]) -1;
			
			int temp = row[ch[0]];
			row[ch[0]] = row[ch[1]];
			row[ch[1]] = temp;
		} int j = 0; int j = 0; j 0 j < ctimes j ctimes j++ j++ j {
			int[] ch = new int[2];
			String[] s = sc.nextLine().split(",");
			ch[0] = Integer.parseInt(s[0]) -1;
			ch[1] = Integer.parseInt(s[1]) -1;
			
			int temp = row[ch[0]];
			row[ch[0]] = row[ch[1]];
			row[ch[1]] = temp;
		} {
			int[] ch = new int[2];
			String[] s = sc.nextLine().split(",");
			ch[0] = Integer.parseInt(s[0]) -1;
			ch[1] = Integer.parseInt(s[1]) -1;
			
			int temp = row[ch[0]];
			row[ch[0]] = row[ch[1]];
			row[ch[1]] = temp;
		} int[] ch = new int[2]; ch new int[2] 2 String[] s = sc.nextLine().split(","); s sc.nextLine().split(",") sc.nextLine().split sc.nextLine() sc.nextLine sc "," ch[0] = Integer.parseInt(s[0]) -1 ch[0] ch 0 Integer.parseInt(s[0]) -1 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 1 ch[1] = Integer.parseInt(s[1]) -1 ch[1] ch 1 Integer.parseInt(s[1]) -1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 1 int temp = row[ch[0]]; temp row[ch[0]] row ch[0] ch 0 row[ch[0]] = row[ch[1]] row[ch[0]] row ch[0] ch 0 row[ch[1]] row ch[1] ch 1 row[ch[1]] = temp row[ch[1]] row ch[1] ch 1 temp for(int i = 0; i < row.length; i++){
			System.out.println(row[i]);
		} int i = 0; int i = 0; i 0 i < row.length i row.length row row.length i++ i++ i {
			System.out.println(row[i]);
		} {
			System.out.println(row[i]);
		} System.out.println(row[i]) System.out.println System.out System System.out row[i] row i String[] args args public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] row = new int[sc.nextInt()];
		for(int i = 0; i < row.length; i++){
			row[i] = i + 1;
		}
		int ctimes = sc.nextInt();
	
		sc.nextLine();
		for(int j = 0; j < ctimes; j++){
			int[] ch = new int[2];
			String[] s = sc.nextLine().split(",");
			ch[0] = Integer.parseInt(s[0]) -1;
			ch[1] = Integer.parseInt(s[1]) -1;
			
			int temp = row[ch[0]];
			row[ch[0]] = row[ch[1]];
			row[ch[1]] = temp;
		}

		for(int i = 0; i < row.length; i++){
			System.out.println(row[i]);
		}
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] row = new int[sc.nextInt()];
		for(int i = 0; i < row.length; i++){
			row[i] = i + 1;
		}
		int ctimes = sc.nextInt();
	
		sc.nextLine();
		for(int j = 0; j < ctimes; j++){
			int[] ch = new int[2];
			String[] s = sc.nextLine().split(",");
			ch[0] = Integer.parseInt(s[0]) -1;
			ch[1] = Integer.parseInt(s[1]) -1;
			
			int temp = row[ch[0]];
			row[ch[0]] = row[ch[1]];
			row[ch[1]] = temp;
		}

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

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] row = new int[sc.nextInt()];
		for(int i = 0; i < row.length; i++){
			row[i] = i + 1;
		}
		int ctimes = sc.nextInt();
	
		sc.nextLine();
		for(int j = 0; j < ctimes; j++){
			int[] ch = new int[2];
			String[] s = sc.nextLine().split(",");
			ch[0] = Integer.parseInt(s[0]) -1;
			ch[1] = Integer.parseInt(s[1]) -1;
			
			int temp = row[ch[0]];
			row[ch[0]] = row[ch[1]];
			row[ch[1]] = temp;
		}

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