import java.util.Scanner;
//import java.io.*;
//import java.util.Arrays;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		//String text = scan.next();
		int w = scan.nextInt();
		int n = scan.nextInt();
		String a[] = new String[n];
		int line[][] = new int[n][2];
		for(int i = 0 ; i< n ; i++){
			a[i] = scan.next();
			String mozi[] =  a[i].split(",", 0);
			for(int j = 0 ; j < 2 ; j++){
				line[i][j] = Integer.parseInt(mozi[j]);
			}
		}
		int answer[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			answer[i] = i+1;
			for(int j = 0 ; j < n ; j++){
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			}
		}
		int goal[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			goal[answer[i]-1] = i+1;
		}
		for(int i = 0 ; i < w ; i++){
			System.out.println(goal[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		//String text = scan.next();
		int w = scan.nextInt();
		int n = scan.nextInt();
		String a[] = new String[n];
		int line[][] = new int[n][2];
		for(int i = 0 ; i< n ; i++){
			a[i] = scan.next();
			String mozi[] =  a[i].split(",", 0);
			for(int j = 0 ; j < 2 ; j++){
				line[i][j] = Integer.parseInt(mozi[j]);
			}
		}
		int answer[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			answer[i] = i+1;
			for(int j = 0 ; j < n ; j++){
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			}
		}
		int goal[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			goal[answer[i]-1] = i+1;
		}
		for(int i = 0 ; i < w ; i++){
			System.out.println(goal[i]);
		}
	}
} Main public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		//String text = scan.next();
		int w = scan.nextInt();
		int n = scan.nextInt();
		String a[] = new String[n];
		int line[][] = new int[n][2];
		for(int i = 0 ; i< n ; i++){
			a[i] = scan.next();
			String mozi[] =  a[i].split(",", 0);
			for(int j = 0 ; j < 2 ; j++){
				line[i][j] = Integer.parseInt(mozi[j]);
			}
		}
		int answer[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			answer[i] = i+1;
			for(int j = 0 ; j < n ; j++){
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			}
		}
		int goal[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			goal[answer[i]-1] = i+1;
		}
		for(int i = 0 ; i < w ; i++){
			System.out.println(goal[i]);
		}
	} main {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		//String text = scan.next();
		int w = scan.nextInt();
		int n = scan.nextInt();
		String a[] = new String[n];
		int line[][] = new int[n][2];
		for(int i = 0 ; i< n ; i++){
			a[i] = scan.next();
			String mozi[] =  a[i].split(",", 0);
			for(int j = 0 ; j < 2 ; j++){
				line[i][j] = Integer.parseInt(mozi[j]);
			}
		}
		int answer[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			answer[i] = i+1;
			for(int j = 0 ; j < n ; j++){
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			}
		}
		int goal[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			goal[answer[i]-1] = i+1;
		}
		for(int i = 0 ; i < w ; i++){
			System.out.println(goal[i]);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w = scan.nextInt(); w scan.nextInt() scan.nextInt scan int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan String a[] = new String[n]; a new String[n] n int line[][] = new int[n][2]; line new int[n][2] n 2 for(int i = 0 ; i< n ; i++){
			a[i] = scan.next();
			String mozi[] =  a[i].split(",", 0);
			for(int j = 0 ; j < 2 ; j++){
				line[i][j] = Integer.parseInt(mozi[j]);
			}
		} int i = 0 ; int i = 0 ; i 0 i< n i n i++ i++ i {
			a[i] = scan.next();
			String mozi[] =  a[i].split(",", 0);
			for(int j = 0 ; j < 2 ; j++){
				line[i][j] = Integer.parseInt(mozi[j]);
			}
		} {
			a[i] = scan.next();
			String mozi[] =  a[i].split(",", 0);
			for(int j = 0 ; j < 2 ; j++){
				line[i][j] = Integer.parseInt(mozi[j]);
			}
		} a[i] = scan.next() a[i] a i scan.next() scan.next scan String mozi[] =  a[i].split(",", 0); mozi a[i].split(",", 0) a[i].split a[i] a i "," 0 for(int j = 0 ; j < 2 ; j++){
				line[i][j] = Integer.parseInt(mozi[j]);
			} int j = 0 ; int j = 0 ; j 0 j < 2 j 2 j++ j++ j {
				line[i][j] = Integer.parseInt(mozi[j]);
			} {
				line[i][j] = Integer.parseInt(mozi[j]);
			} line[i][j] = Integer.parseInt(mozi[j]) line[i][j] line[i] line i j Integer.parseInt(mozi[j]) Integer.parseInt Integer mozi[j] mozi j int answer[] = new int[w]; answer new int[w] w for(int i = 0 ; i < w ; i++){
			answer[i] = i+1;
			for(int j = 0 ; j < n ; j++){
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			}
		} int i = 0 ; int i = 0 ; i 0 i < w i w i++ i++ i {
			answer[i] = i+1;
			for(int j = 0 ; j < n ; j++){
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			}
		} {
			answer[i] = i+1;
			for(int j = 0 ; j < n ; j++){
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			}
		} answer[i] = i+1 answer[i] answer i i+1 i 1 for(int j = 0 ; j < n ; j++){
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			} int j = 0 ; int j = 0 ; j 0 j < n j n j++ j++ j {
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			} {
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			} if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				} line[j][0] == answer[i] || line[j][1] == answer[i] line[j][0] == answer[i] line[j][0] line[j] line j 0 answer[i] answer i line[j][1] == answer[i] line[j][1] line[j] line j 1 answer[i] answer i {
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				} if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					} line[j][0] == answer[i] line[j][0] line[j] line j 0 answer[i] answer i {
						answer[i] = line[j][1];
					} answer[i] = line[j][1] answer[i] answer i line[j][1] line[j] line j 1 {
						answer[i] = line[j][0];
					} answer[i] = line[j][0] answer[i] answer i line[j][0] line[j] line j 0 int goal[] = new int[w]; goal new int[w] w for(int i = 0 ; i < w ; i++){
			goal[answer[i]-1] = i+1;
		} int i = 0 ; int i = 0 ; i 0 i < w i w i++ i++ i {
			goal[answer[i]-1] = i+1;
		} {
			goal[answer[i]-1] = i+1;
		} goal[answer[i]-1] = i+1 goal[answer[i]-1] goal answer[i]-1 answer[i] answer i 1 i+1 i 1 for(int i = 0 ; i < w ; i++){
			System.out.println(goal[i]);
		} int i = 0 ; int i = 0 ; i 0 i < w i w i++ i++ i {
			System.out.println(goal[i]);
		} {
			System.out.println(goal[i]);
		} System.out.println(goal[i]) System.out.println System.out System System.out goal[i] goal i String[] args args public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		//String text = scan.next();
		int w = scan.nextInt();
		int n = scan.nextInt();
		String a[] = new String[n];
		int line[][] = new int[n][2];
		for(int i = 0 ; i< n ; i++){
			a[i] = scan.next();
			String mozi[] =  a[i].split(",", 0);
			for(int j = 0 ; j < 2 ; j++){
				line[i][j] = Integer.parseInt(mozi[j]);
			}
		}
		int answer[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			answer[i] = i+1;
			for(int j = 0 ; j < n ; j++){
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			}
		}
		int goal[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			goal[answer[i]-1] = i+1;
		}
		for(int i = 0 ; i < w ; i++){
			System.out.println(goal[i]);
		}
	}
} public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		//String text = scan.next();
		int w = scan.nextInt();
		int n = scan.nextInt();
		String a[] = new String[n];
		int line[][] = new int[n][2];
		for(int i = 0 ; i< n ; i++){
			a[i] = scan.next();
			String mozi[] =  a[i].split(",", 0);
			for(int j = 0 ; j < 2 ; j++){
				line[i][j] = Integer.parseInt(mozi[j]);
			}
		}
		int answer[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			answer[i] = i+1;
			for(int j = 0 ; j < n ; j++){
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			}
		}
		int goal[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			goal[answer[i]-1] = i+1;
		}
		for(int i = 0 ; i < w ; i++){
			System.out.println(goal[i]);
		}
	}
} Main
import java.util.Scanner;
//import java.io.*;
//import java.util.Arrays;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		//String text = scan.next();
		int w = scan.nextInt();
		int n = scan.nextInt();
		String a[] = new String[n];
		int line[][] = new int[n][2];
		for(int i = 0 ; i< n ; i++){
			a[i] = scan.next();
			String mozi[] =  a[i].split(",", 0);
			for(int j = 0 ; j < 2 ; j++){
				line[i][j] = Integer.parseInt(mozi[j]);
			}
		}
		int answer[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			answer[i] = i+1;
			for(int j = 0 ; j < n ; j++){
				if(line[j][0] == answer[i] || line[j][1] == answer[i]){
					if(line[j][0] == answer[i]){
						answer[i] = line[j][1];
					}else{
						answer[i] = line[j][0];
					}
				}
			}
		}
		int goal[] = new int[w];
		for(int i = 0 ; i < w ; i++){
			goal[answer[i]-1] = i+1;
		}
		for(int i = 0 ; i < w ; i++){
			System.out.println(goal[i]);
		}
	}
}