import java.util.Scanner;

class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int vertical;
		int cross;
		int[] num = new int[30];
		int[] change = new int[2];
		int i,tmp;
		String Line;
		String splitLine[] = new String[2];
		
		vertical = scan.nextInt();
		cross = scan.nextInt();
		
		for(i=0;i<vertical;i++){
			num[i] = i+1;
		}
		
		for(i=0;i<cross;i++){
			Line = scan.next();
			splitLine = Line.split(",");
			
			change[0] = Integer.parseInt(splitLine[0]);
			change[1] = Integer.parseInt(splitLine[1]);
			
			tmp = num[change[0]-1];
			num[change[0]-1] = num[change[1]-1];
			num[change[1]-1] = tmp;
		}
		
		for(i=0;i<vertical;i++){
			System.out.println(num[i]);
		}
		
		scan.close();
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int vertical;
		int cross;
		int[] num = new int[30];
		int[] change = new int[2];
		int i,tmp;
		String Line;
		String splitLine[] = new String[2];
		
		vertical = scan.nextInt();
		cross = scan.nextInt();
		
		for(i=0;i<vertical;i++){
			num[i] = i+1;
		}
		
		for(i=0;i<cross;i++){
			Line = scan.next();
			splitLine = Line.split(",");
			
			change[0] = Integer.parseInt(splitLine[0]);
			change[1] = Integer.parseInt(splitLine[1]);
			
			tmp = num[change[0]-1];
			num[change[0]-1] = num[change[1]-1];
			num[change[1]-1] = tmp;
		}
		
		for(i=0;i<vertical;i++){
			System.out.println(num[i]);
		}
		
		scan.close();
	}
} Main public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int vertical;
		int cross;
		int[] num = new int[30];
		int[] change = new int[2];
		int i,tmp;
		String Line;
		String splitLine[] = new String[2];
		
		vertical = scan.nextInt();
		cross = scan.nextInt();
		
		for(i=0;i<vertical;i++){
			num[i] = i+1;
		}
		
		for(i=0;i<cross;i++){
			Line = scan.next();
			splitLine = Line.split(",");
			
			change[0] = Integer.parseInt(splitLine[0]);
			change[1] = Integer.parseInt(splitLine[1]);
			
			tmp = num[change[0]-1];
			num[change[0]-1] = num[change[1]-1];
			num[change[1]-1] = tmp;
		}
		
		for(i=0;i<vertical;i++){
			System.out.println(num[i]);
		}
		
		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		
		int vertical;
		int cross;
		int[] num = new int[30];
		int[] change = new int[2];
		int i,tmp;
		String Line;
		String splitLine[] = new String[2];
		
		vertical = scan.nextInt();
		cross = scan.nextInt();
		
		for(i=0;i<vertical;i++){
			num[i] = i+1;
		}
		
		for(i=0;i<cross;i++){
			Line = scan.next();
			splitLine = Line.split(",");
			
			change[0] = Integer.parseInt(splitLine[0]);
			change[1] = Integer.parseInt(splitLine[1]);
			
			tmp = num[change[0]-1];
			num[change[0]-1] = num[change[1]-1];
			num[change[1]-1] = tmp;
		}
		
		for(i=0;i<vertical;i++){
			System.out.println(num[i]);
		}
		
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int vertical; vertical int cross; cross int[] num = new int[30]; num new int[30] 30 int[] change = new int[2]; change new int[2] 2 int i i tmp; tmp String Line; Line String splitLine[] = new String[2]; splitLine new String[2] 2 vertical = scan.nextInt() vertical scan.nextInt() scan.nextInt scan cross = scan.nextInt() cross scan.nextInt() scan.nextInt scan for(i=0;i<vertical;i++){
			num[i] = i+1;
		} i=0; i=0 i 0 i<vertical i vertical i++ i++ i {
			num[i] = i+1;
		} {
			num[i] = i+1;
		} num[i] = i+1 num[i] num i i+1 i 1 for(i=0;i<cross;i++){
			Line = scan.next();
			splitLine = Line.split(",");
			
			change[0] = Integer.parseInt(splitLine[0]);
			change[1] = Integer.parseInt(splitLine[1]);
			
			tmp = num[change[0]-1];
			num[change[0]-1] = num[change[1]-1];
			num[change[1]-1] = tmp;
		} i=0; i=0 i 0 i<cross i cross i++ i++ i {
			Line = scan.next();
			splitLine = Line.split(",");
			
			change[0] = Integer.parseInt(splitLine[0]);
			change[1] = Integer.parseInt(splitLine[1]);
			
			tmp = num[change[0]-1];
			num[change[0]-1] = num[change[1]-1];
			num[change[1]-1] = tmp;
		} {
			Line = scan.next();
			splitLine = Line.split(",");
			
			change[0] = Integer.parseInt(splitLine[0]);
			change[1] = Integer.parseInt(splitLine[1]);
			
			tmp = num[change[0]-1];
			num[change[0]-1] = num[change[1]-1];
			num[change[1]-1] = tmp;
		} Line = scan.next() Line scan.next() scan.next scan splitLine = Line.split(",") splitLine Line.split(",") Line.split Line "," change[0] = Integer.parseInt(splitLine[0]) change[0] change 0 Integer.parseInt(splitLine[0]) Integer.parseInt Integer splitLine[0] splitLine 0 change[1] = Integer.parseInt(splitLine[1]) change[1] change 1 Integer.parseInt(splitLine[1]) Integer.parseInt Integer splitLine[1] splitLine 1 tmp = num[change[0]-1] tmp num[change[0]-1] num change[0]-1 change[0] change 0 1 num[change[0]-1] = num[change[1]-1] num[change[0]-1] num change[0]-1 change[0] change 0 1 num[change[1]-1] num change[1]-1 change[1] change 1 1 num[change[1]-1] = tmp num[change[1]-1] num change[1]-1 change[1] change 1 1 tmp for(i=0;i<vertical;i++){
			System.out.println(num[i]);
		} i=0; i=0 i 0 i<vertical i vertical i++ i++ i {
			System.out.println(num[i]);
		} {
			System.out.println(num[i]);
		} System.out.println(num[i]) System.out.println System.out System System.out num[i] num i scan.close() scan.close scan String args[] args
import java.util.Scanner;

class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int vertical;
		int cross;
		int[] num = new int[30];
		int[] change = new int[2];
		int i,tmp;
		String Line;
		String splitLine[] = new String[2];
		
		vertical = scan.nextInt();
		cross = scan.nextInt();
		
		for(i=0;i<vertical;i++){
			num[i] = i+1;
		}
		
		for(i=0;i<cross;i++){
			Line = scan.next();
			splitLine = Line.split(",");
			
			change[0] = Integer.parseInt(splitLine[0]);
			change[1] = Integer.parseInt(splitLine[1]);
			
			tmp = num[change[0]-1];
			num[change[0]-1] = num[change[1]-1];
			num[change[1]-1] = tmp;
		}
		
		for(i=0;i<vertical;i++){
			System.out.println(num[i]);
		}
		
		scan.close();
	}
}