import java.util.Scanner;


public class Main {
    public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	int n = input.nextInt();
    	int m = input.nextInt();
    	int[] num = new int[n];
    	for(int i = 0 ; i < n ; i++){
    		num[i] = (i+1);
    	}
    	for(int i = 0 ; i < m ; i++){
    		String[] s = input.next().split(",");
    		int a = Integer.parseInt(s[0])-1;
    		int b = Integer.parseInt(s[1])-1;
    		int tmp = num[a];
    		num[a] = num[b];
    		num[b] = tmp;
    	}
    	for(int i = 0 ; i < n ; i++){
    		System.out.println(num[i]);
    	}
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	int n = input.nextInt();
    	int m = input.nextInt();
    	int[] num = new int[n];
    	for(int i = 0 ; i < n ; i++){
    		num[i] = (i+1);
    	}
    	for(int i = 0 ; i < m ; i++){
    		String[] s = input.next().split(",");
    		int a = Integer.parseInt(s[0])-1;
    		int b = Integer.parseInt(s[1])-1;
    		int tmp = num[a];
    		num[a] = num[b];
    		num[b] = tmp;
    	}
    	for(int i = 0 ; i < n ; i++){
    		System.out.println(num[i]);
    	}
    }
} Main public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	int n = input.nextInt();
    	int m = input.nextInt();
    	int[] num = new int[n];
    	for(int i = 0 ; i < n ; i++){
    		num[i] = (i+1);
    	}
    	for(int i = 0 ; i < m ; i++){
    		String[] s = input.next().split(",");
    		int a = Integer.parseInt(s[0])-1;
    		int b = Integer.parseInt(s[1])-1;
    		int tmp = num[a];
    		num[a] = num[b];
    		num[b] = tmp;
    	}
    	for(int i = 0 ; i < n ; i++){
    		System.out.println(num[i]);
    	}
    } main {
    	Scanner input = new Scanner(System.in);
    	int n = input.nextInt();
    	int m = input.nextInt();
    	int[] num = new int[n];
    	for(int i = 0 ; i < n ; i++){
    		num[i] = (i+1);
    	}
    	for(int i = 0 ; i < m ; i++){
    		String[] s = input.next().split(",");
    		int a = Integer.parseInt(s[0])-1;
    		int b = Integer.parseInt(s[1])-1;
    		int tmp = num[a];
    		num[a] = num[b];
    		num[b] = tmp;
    	}
    	for(int i = 0 ; i < n ; i++){
    		System.out.println(num[i]);
    	}
    } Scanner input = new Scanner(System.in); input new Scanner(System.in) int n = input.nextInt(); n input.nextInt() input.nextInt input int m = input.nextInt(); m input.nextInt() input.nextInt input int[] num = new int[n]; num new int[n] n for(int i = 0 ; i < n ; i++){
    		num[i] = (i+1);
    	} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
    		num[i] = (i+1);
    	} {
    		num[i] = (i+1);
    	} num[i] = (i+1) num[i] num i (i+1) i 1 for(int i = 0 ; i < m ; i++){
    		String[] s = input.next().split(",");
    		int a = Integer.parseInt(s[0])-1;
    		int b = Integer.parseInt(s[1])-1;
    		int tmp = num[a];
    		num[a] = num[b];
    		num[b] = tmp;
    	} int i = 0 ; int i = 0 ; i 0 i < m i m i++ i++ i {
    		String[] s = input.next().split(",");
    		int a = Integer.parseInt(s[0])-1;
    		int b = Integer.parseInt(s[1])-1;
    		int tmp = num[a];
    		num[a] = num[b];
    		num[b] = tmp;
    	} {
    		String[] s = input.next().split(",");
    		int a = Integer.parseInt(s[0])-1;
    		int b = Integer.parseInt(s[1])-1;
    		int tmp = num[a];
    		num[a] = num[b];
    		num[b] = tmp;
    	} String[] s = input.next().split(","); s input.next().split(",") input.next().split input.next() input.next input "," int a = Integer.parseInt(s[0])-1; a Integer.parseInt(s[0])-1 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 1 int b = Integer.parseInt(s[1])-1; b Integer.parseInt(s[1])-1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 1 int tmp = num[a]; tmp num[a] num a num[a] = num[b] num[a] num a num[b] num b num[b] = tmp num[b] num b tmp for(int i = 0 ; i < n ; i++){
    		System.out.println(num[i]);
    	} int i = 0 ; int i = 0 ; i 0 i < n i n 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 String[] args args public class Main {
    public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	int n = input.nextInt();
    	int m = input.nextInt();
    	int[] num = new int[n];
    	for(int i = 0 ; i < n ; i++){
    		num[i] = (i+1);
    	}
    	for(int i = 0 ; i < m ; i++){
    		String[] s = input.next().split(",");
    		int a = Integer.parseInt(s[0])-1;
    		int b = Integer.parseInt(s[1])-1;
    		int tmp = num[a];
    		num[a] = num[b];
    		num[b] = tmp;
    	}
    	for(int i = 0 ; i < n ; i++){
    		System.out.println(num[i]);
    	}
    }
} public class Main {
    public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	int n = input.nextInt();
    	int m = input.nextInt();
    	int[] num = new int[n];
    	for(int i = 0 ; i < n ; i++){
    		num[i] = (i+1);
    	}
    	for(int i = 0 ; i < m ; i++){
    		String[] s = input.next().split(",");
    		int a = Integer.parseInt(s[0])-1;
    		int b = Integer.parseInt(s[1])-1;
    		int tmp = num[a];
    		num[a] = num[b];
    		num[b] = tmp;
    	}
    	for(int i = 0 ; i < n ; i++){
    		System.out.println(num[i]);
    	}
    }
} Main
import java.util.Scanner;


public class Main {
    public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	int n = input.nextInt();
    	int m = input.nextInt();
    	int[] num = new int[n];
    	for(int i = 0 ; i < n ; i++){
    		num[i] = (i+1);
    	}
    	for(int i = 0 ; i < m ; i++){
    		String[] s = input.next().split(",");
    		int a = Integer.parseInt(s[0])-1;
    		int b = Integer.parseInt(s[1])-1;
    		int tmp = num[a];
    		num[a] = num[b];
    		num[b] = tmp;
    	}
    	for(int i = 0 ; i < n ; i++){
    		System.out.println(num[i]);
    	}
    }
}