import java.util.Scanner;

public class Main{
	public static void swap(int[] m, int x, int y){
		int temp = m[x-1];
		m[x-1] = m[y-1];
		m[y-1] = temp;
	}
		
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		int w = stdIn.nextInt();
		int[] m = new int[w];
		for(int i = 0; i < w; i++){
			m[i] = i+1;
		}
		int n = stdIn.nextInt();
		String[] str = new String[n];
		for(int i = 0; i < n; i++){
			str[i] = stdIn.next();
		}
		String[][] s = new String[n][2];
		int[][] line = new int[n][2];
		for(int i = 0; i < n; i++){
			s[i] = str[i].split(",");
			line[i][0] = Integer.parseInt(s[i][0]);
			line[i][1] = Integer.parseInt(s[i][1]);
		}
		for(int i = 0; i < n; i++){
			swap(m,line[i][0],line[i][1]);
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(m[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void swap(int[] m, int x, int y){
		int temp = m[x-1];
		m[x-1] = m[y-1];
		m[y-1] = temp;
	}
		
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		int w = stdIn.nextInt();
		int[] m = new int[w];
		for(int i = 0; i < w; i++){
			m[i] = i+1;
		}
		int n = stdIn.nextInt();
		String[] str = new String[n];
		for(int i = 0; i < n; i++){
			str[i] = stdIn.next();
		}
		String[][] s = new String[n][2];
		int[][] line = new int[n][2];
		for(int i = 0; i < n; i++){
			s[i] = str[i].split(",");
			line[i][0] = Integer.parseInt(s[i][0]);
			line[i][1] = Integer.parseInt(s[i][1]);
		}
		for(int i = 0; i < n; i++){
			swap(m,line[i][0],line[i][1]);
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(m[i]);
		}
	}
} Main public static void swap(int[] m, int x, int y){
		int temp = m[x-1];
		m[x-1] = m[y-1];
		m[y-1] = temp;
	} swap {
		int temp = m[x-1];
		m[x-1] = m[y-1];
		m[y-1] = temp;
	} int temp = m[x-1]; temp m[x-1] m x-1 x 1 m[x-1] = m[y-1] m[x-1] m x-1 x 1 m[y-1] m y-1 y 1 m[y-1] = temp m[y-1] m y-1 y 1 temp int[] m m int x x int y y public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		int w = stdIn.nextInt();
		int[] m = new int[w];
		for(int i = 0; i < w; i++){
			m[i] = i+1;
		}
		int n = stdIn.nextInt();
		String[] str = new String[n];
		for(int i = 0; i < n; i++){
			str[i] = stdIn.next();
		}
		String[][] s = new String[n][2];
		int[][] line = new int[n][2];
		for(int i = 0; i < n; i++){
			s[i] = str[i].split(",");
			line[i][0] = Integer.parseInt(s[i][0]);
			line[i][1] = Integer.parseInt(s[i][1]);
		}
		for(int i = 0; i < n; i++){
			swap(m,line[i][0],line[i][1]);
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(m[i]);
		}
	} main {
		Scanner stdIn = new Scanner(System.in);
		
		int w = stdIn.nextInt();
		int[] m = new int[w];
		for(int i = 0; i < w; i++){
			m[i] = i+1;
		}
		int n = stdIn.nextInt();
		String[] str = new String[n];
		for(int i = 0; i < n; i++){
			str[i] = stdIn.next();
		}
		String[][] s = new String[n][2];
		int[][] line = new int[n][2];
		for(int i = 0; i < n; i++){
			s[i] = str[i].split(",");
			line[i][0] = Integer.parseInt(s[i][0]);
			line[i][1] = Integer.parseInt(s[i][1]);
		}
		for(int i = 0; i < n; i++){
			swap(m,line[i][0],line[i][1]);
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(m[i]);
		}
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int w = stdIn.nextInt(); w stdIn.nextInt() stdIn.nextInt stdIn int[] m = new int[w]; m new int[w] w for(int i = 0; i < w; i++){
			m[i] = i+1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			m[i] = i+1;
		} {
			m[i] = i+1;
		} m[i] = i+1 m[i] m i i+1 i 1 int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn String[] str = new String[n]; str new String[n] n for(int i = 0; i < n; i++){
			str[i] = stdIn.next();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			str[i] = stdIn.next();
		} {
			str[i] = stdIn.next();
		} str[i] = stdIn.next() str[i] str i stdIn.next() stdIn.next stdIn String[][] s = new String[n][2]; s new String[n][2] n 2 int[][] line = new int[n][2]; line new int[n][2] n 2 for(int i = 0; i < n; i++){
			s[i] = str[i].split(",");
			line[i][0] = Integer.parseInt(s[i][0]);
			line[i][1] = Integer.parseInt(s[i][1]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			s[i] = str[i].split(",");
			line[i][0] = Integer.parseInt(s[i][0]);
			line[i][1] = Integer.parseInt(s[i][1]);
		} {
			s[i] = str[i].split(",");
			line[i][0] = Integer.parseInt(s[i][0]);
			line[i][1] = Integer.parseInt(s[i][1]);
		} s[i] = str[i].split(",") s[i] s i str[i].split(",") str[i].split str[i] str i "," line[i][0] = Integer.parseInt(s[i][0]) line[i][0] line[i] line i 0 Integer.parseInt(s[i][0]) Integer.parseInt Integer s[i][0] s[i] s i 0 line[i][1] = Integer.parseInt(s[i][1]) line[i][1] line[i] line i 1 Integer.parseInt(s[i][1]) Integer.parseInt Integer s[i][1] s[i] s i 1 for(int i = 0; i < n; i++){
			swap(m,line[i][0],line[i][1]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			swap(m,line[i][0],line[i][1]);
		} {
			swap(m,line[i][0],line[i][1]);
		} swap(m,line[i][0],line[i][1]) swap m line[i][0] line[i] line i 0 line[i][1] line[i] line i 1 for(int i = 0; i < w; i++){
			System.out.println(m[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(m[i]);
		} {
			System.out.println(m[i]);
		} System.out.println(m[i]) System.out.println System.out System System.out m[i] m i String[] args args public class Main{
	public static void swap(int[] m, int x, int y){
		int temp = m[x-1];
		m[x-1] = m[y-1];
		m[y-1] = temp;
	}
		
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		int w = stdIn.nextInt();
		int[] m = new int[w];
		for(int i = 0; i < w; i++){
			m[i] = i+1;
		}
		int n = stdIn.nextInt();
		String[] str = new String[n];
		for(int i = 0; i < n; i++){
			str[i] = stdIn.next();
		}
		String[][] s = new String[n][2];
		int[][] line = new int[n][2];
		for(int i = 0; i < n; i++){
			s[i] = str[i].split(",");
			line[i][0] = Integer.parseInt(s[i][0]);
			line[i][1] = Integer.parseInt(s[i][1]);
		}
		for(int i = 0; i < n; i++){
			swap(m,line[i][0],line[i][1]);
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(m[i]);
		}
	}
} public class Main{
	public static void swap(int[] m, int x, int y){
		int temp = m[x-1];
		m[x-1] = m[y-1];
		m[y-1] = temp;
	}
		
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		int w = stdIn.nextInt();
		int[] m = new int[w];
		for(int i = 0; i < w; i++){
			m[i] = i+1;
		}
		int n = stdIn.nextInt();
		String[] str = new String[n];
		for(int i = 0; i < n; i++){
			str[i] = stdIn.next();
		}
		String[][] s = new String[n][2];
		int[][] line = new int[n][2];
		for(int i = 0; i < n; i++){
			s[i] = str[i].split(",");
			line[i][0] = Integer.parseInt(s[i][0]);
			line[i][1] = Integer.parseInt(s[i][1]);
		}
		for(int i = 0; i < n; i++){
			swap(m,line[i][0],line[i][1]);
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(m[i]);
		}
	}
} Main
import java.util.Scanner;

public class Main{
	public static void swap(int[] m, int x, int y){
		int temp = m[x-1];
		m[x-1] = m[y-1];
		m[y-1] = temp;
	}
		
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		int w = stdIn.nextInt();
		int[] m = new int[w];
		for(int i = 0; i < w; i++){
			m[i] = i+1;
		}
		int n = stdIn.nextInt();
		String[] str = new String[n];
		for(int i = 0; i < n; i++){
			str[i] = stdIn.next();
		}
		String[][] s = new String[n][2];
		int[][] line = new int[n][2];
		for(int i = 0; i < n; i++){
			s[i] = str[i].split(",");
			line[i][0] = Integer.parseInt(s[i][0]);
			line[i][1] = Integer.parseInt(s[i][1]);
		}
		for(int i = 0; i < n; i++){
			swap(m,line[i][0],line[i][1]);
		}
		
		for(int i = 0; i < w; i++){
			System.out.println(m[i]);
		}
	}
}