import java.util.Scanner;
class Main{
    public static void main(String[] a){
        Scanner stdin = new Scanner(System.in);
        int lt = stdin.nextInt();
        int[] line = new int[lt + 1];
        for(int i = 1; i <= lt; i++){
            line[i] = i;
        }
        int n = stdin.nextInt();
        for(int i = 0; i < n; i++){
            String str = stdin.next();
            String[] spl = str.split(",");
            int num1 = Integer.parseInt(spl[0]);
            int num2 = Integer.parseInt(spl[1]);
            int sum = line[num1];
            line[num1] = line[num2];
            line[num2] = sum;
        }
        for(int i = 1; i <= lt; i++){
            System.out.println(line[i]);
        }
    }
}
  import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] a){
        Scanner stdin = new Scanner(System.in);
        int lt = stdin.nextInt();
        int[] line = new int[lt + 1];
        for(int i = 1; i <= lt; i++){
            line[i] = i;
        }
        int n = stdin.nextInt();
        for(int i = 0; i < n; i++){
            String str = stdin.next();
            String[] spl = str.split(",");
            int num1 = Integer.parseInt(spl[0]);
            int num2 = Integer.parseInt(spl[1]);
            int sum = line[num1];
            line[num1] = line[num2];
            line[num2] = sum;
        }
        for(int i = 1; i <= lt; i++){
            System.out.println(line[i]);
        }
    }
} Main public static void main(String[] a){
        Scanner stdin = new Scanner(System.in);
        int lt = stdin.nextInt();
        int[] line = new int[lt + 1];
        for(int i = 1; i <= lt; i++){
            line[i] = i;
        }
        int n = stdin.nextInt();
        for(int i = 0; i < n; i++){
            String str = stdin.next();
            String[] spl = str.split(",");
            int num1 = Integer.parseInt(spl[0]);
            int num2 = Integer.parseInt(spl[1]);
            int sum = line[num1];
            line[num1] = line[num2];
            line[num2] = sum;
        }
        for(int i = 1; i <= lt; i++){
            System.out.println(line[i]);
        }
    } main {
        Scanner stdin = new Scanner(System.in);
        int lt = stdin.nextInt();
        int[] line = new int[lt + 1];
        for(int i = 1; i <= lt; i++){
            line[i] = i;
        }
        int n = stdin.nextInt();
        for(int i = 0; i < n; i++){
            String str = stdin.next();
            String[] spl = str.split(",");
            int num1 = Integer.parseInt(spl[0]);
            int num2 = Integer.parseInt(spl[1]);
            int sum = line[num1];
            line[num1] = line[num2];
            line[num2] = sum;
        }
        for(int i = 1; i <= lt; i++){
            System.out.println(line[i]);
        }
    } Scanner stdin = new Scanner(System.in); stdin new Scanner(System.in) int lt = stdin.nextInt(); lt stdin.nextInt() stdin.nextInt stdin int[] line = new int[lt + 1]; line new int[lt + 1] lt + 1 lt 1 for(int i = 1; i <= lt; i++){
            line[i] = i;
        } int i = 1; int i = 1; i 1 i <= lt i lt i++ i++ i {
            line[i] = i;
        } {
            line[i] = i;
        } line[i] = i line[i] line i i int n = stdin.nextInt(); n stdin.nextInt() stdin.nextInt stdin for(int i = 0; i < n; i++){
            String str = stdin.next();
            String[] spl = str.split(",");
            int num1 = Integer.parseInt(spl[0]);
            int num2 = Integer.parseInt(spl[1]);
            int sum = line[num1];
            line[num1] = line[num2];
            line[num2] = sum;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String str = stdin.next();
            String[] spl = str.split(",");
            int num1 = Integer.parseInt(spl[0]);
            int num2 = Integer.parseInt(spl[1]);
            int sum = line[num1];
            line[num1] = line[num2];
            line[num2] = sum;
        } {
            String str = stdin.next();
            String[] spl = str.split(",");
            int num1 = Integer.parseInt(spl[0]);
            int num2 = Integer.parseInt(spl[1]);
            int sum = line[num1];
            line[num1] = line[num2];
            line[num2] = sum;
        } String str = stdin.next(); str stdin.next() stdin.next stdin String[] spl = str.split(","); spl str.split(",") str.split str "," int num1 = Integer.parseInt(spl[0]); num1 Integer.parseInt(spl[0]) Integer.parseInt Integer spl[0] spl 0 int num2 = Integer.parseInt(spl[1]); num2 Integer.parseInt(spl[1]) Integer.parseInt Integer spl[1] spl 1 int sum = line[num1]; sum line[num1] line num1 line[num1] = line[num2] line[num1] line num1 line[num2] line num2 line[num2] = sum line[num2] line num2 sum for(int i = 1; i <= lt; i++){
            System.out.println(line[i]);
        } int i = 1; int i = 1; i 1 i <= lt i lt i++ i++ i {
            System.out.println(line[i]);
        } {
            System.out.println(line[i]);
        } System.out.println(line[i]) System.out.println System.out System System.out line[i] line i String[] a a
import java.util.Scanner;
class Main{
    public static void main(String[] a){
        Scanner stdin = new Scanner(System.in);
        int lt = stdin.nextInt();
        int[] line = new int[lt + 1];
        for(int i = 1; i <= lt; i++){
            line[i] = i;
        }
        int n = stdin.nextInt();
        for(int i = 0; i < n; i++){
            String str = stdin.next();
            String[] spl = str.split(",");
            int num1 = Integer.parseInt(spl[0]);
            int num2 = Integer.parseInt(spl[1]);
            int sum = line[num1];
            line[num1] = line[num2];
            line[num2] = sum;
        }
        for(int i = 1; i <= lt; i++){
            System.out.println(line[i]);
        }
    }
}
 