import java.io.*;
import java.util.*;
import java.lang.Math;
import java.util.Arrays;

public class Main {
    public static void main(final String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int w = sc.nextInt();
        int ar[] = new int[w];
        int n = sc.nextInt();
        for (int i = 0; i < w; i++)
            ar[i] = i + 1;
        for (int i = 0; i < n; i++) {
            String buf = sc.next();
            String buf2[] = buf.split(",");
            int a = Integer.parseInt(buf2[0]) - 1, 
                b = Integer.parseInt(buf2[1]) - 1;
            int tmp = ar[a];
            ar[a] = ar[b];
            ar[b] = tmp;
        }
        
        for (int i = 0; i < w; i++) {
            System.out.printf("%d\n", ar[i]);
        }
    }
  
} import java.io.*; io.* java import java.util.*; util.* java import java.lang.Math; Math java.lang import java.util.Arrays; Arrays java.util public class Main {
    public static void main(final String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int w = sc.nextInt();
        int ar[] = new int[w];
        int n = sc.nextInt();
        for (int i = 0; i < w; i++)
            ar[i] = i + 1;
        for (int i = 0; i < n; i++) {
            String buf = sc.next();
            String buf2[] = buf.split(",");
            int a = Integer.parseInt(buf2[0]) - 1, 
                b = Integer.parseInt(buf2[1]) - 1;
            int tmp = ar[a];
            ar[a] = ar[b];
            ar[b] = tmp;
        }
        
        for (int i = 0; i < w; i++) {
            System.out.printf("%d\n", ar[i]);
        }
    }
  
} Main public static void main(final String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int w = sc.nextInt();
        int ar[] = new int[w];
        int n = sc.nextInt();
        for (int i = 0; i < w; i++)
            ar[i] = i + 1;
        for (int i = 0; i < n; i++) {
            String buf = sc.next();
            String buf2[] = buf.split(",");
            int a = Integer.parseInt(buf2[0]) - 1, 
                b = Integer.parseInt(buf2[1]) - 1;
            int tmp = ar[a];
            ar[a] = ar[b];
            ar[b] = tmp;
        }
        
        for (int i = 0; i < w; i++) {
            System.out.printf("%d\n", ar[i]);
        }
    } main {

        Scanner sc = new Scanner(System.in);
        
        int w = sc.nextInt();
        int ar[] = new int[w];
        int n = sc.nextInt();
        for (int i = 0; i < w; i++)
            ar[i] = i + 1;
        for (int i = 0; i < n; i++) {
            String buf = sc.next();
            String buf2[] = buf.split(",");
            int a = Integer.parseInt(buf2[0]) - 1, 
                b = Integer.parseInt(buf2[1]) - 1;
            int tmp = ar[a];
            ar[a] = ar[b];
            ar[b] = tmp;
        }
        
        for (int i = 0; i < w; i++) {
            System.out.printf("%d\n", ar[i]);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int ar[] = new int[w]; ar new int[w] w int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for (int i = 0; i < w; i++)
            ar[i] = i + 1; int i = 0; int i = 0; i 0 i < w i w i++ i++ i ar[i] = i + 1; ar[i] = i + 1 ar[i] ar i i + 1 i 1 for (int i = 0; i < n; i++) {
            String buf = sc.next();
            String buf2[] = buf.split(",");
            int a = Integer.parseInt(buf2[0]) - 1, 
                b = Integer.parseInt(buf2[1]) - 1;
            int tmp = ar[a];
            ar[a] = ar[b];
            ar[b] = tmp;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String buf = sc.next();
            String buf2[] = buf.split(",");
            int a = Integer.parseInt(buf2[0]) - 1, 
                b = Integer.parseInt(buf2[1]) - 1;
            int tmp = ar[a];
            ar[a] = ar[b];
            ar[b] = tmp;
        } {
            String buf = sc.next();
            String buf2[] = buf.split(",");
            int a = Integer.parseInt(buf2[0]) - 1, 
                b = Integer.parseInt(buf2[1]) - 1;
            int tmp = ar[a];
            ar[a] = ar[b];
            ar[b] = tmp;
        } String buf = sc.next(); buf sc.next() sc.next sc String buf2[] = buf.split(","); buf2 buf.split(",") buf.split buf "," int a = Integer.parseInt(buf2[0]) - 1 a Integer.parseInt(buf2[0]) - 1 Integer.parseInt(buf2[0]) Integer.parseInt Integer buf2[0] buf2 0 1 b = Integer.parseInt(buf2[1]) - 1; b Integer.parseInt(buf2[1]) - 1 Integer.parseInt(buf2[1]) Integer.parseInt Integer buf2[1] buf2 1 1 int tmp = ar[a]; tmp ar[a] ar a ar[a] = ar[b] ar[a] ar a ar[b] ar b ar[b] = tmp ar[b] ar b tmp for (int i = 0; i < w; i++) {
            System.out.printf("%d\n", ar[i]);
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            System.out.printf("%d\n", ar[i]);
        } {
            System.out.printf("%d\n", ar[i]);
        } System.out.printf("%d\n", ar[i]) System.out.printf System.out System System.out "%d\n" ar[i] ar i final String[] args args public class Main {
    public static void main(final String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int w = sc.nextInt();
        int ar[] = new int[w];
        int n = sc.nextInt();
        for (int i = 0; i < w; i++)
            ar[i] = i + 1;
        for (int i = 0; i < n; i++) {
            String buf = sc.next();
            String buf2[] = buf.split(",");
            int a = Integer.parseInt(buf2[0]) - 1, 
                b = Integer.parseInt(buf2[1]) - 1;
            int tmp = ar[a];
            ar[a] = ar[b];
            ar[b] = tmp;
        }
        
        for (int i = 0; i < w; i++) {
            System.out.printf("%d\n", ar[i]);
        }
    }
  
} public class Main {
    public static void main(final String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int w = sc.nextInt();
        int ar[] = new int[w];
        int n = sc.nextInt();
        for (int i = 0; i < w; i++)
            ar[i] = i + 1;
        for (int i = 0; i < n; i++) {
            String buf = sc.next();
            String buf2[] = buf.split(",");
            int a = Integer.parseInt(buf2[0]) - 1, 
                b = Integer.parseInt(buf2[1]) - 1;
            int tmp = ar[a];
            ar[a] = ar[b];
            ar[b] = tmp;
        }
        
        for (int i = 0; i < w; i++) {
            System.out.printf("%d\n", ar[i]);
        }
    }
  
} Main
import java.io.*;
import java.util.*;
import java.lang.Math;
import java.util.Arrays;

public class Main {
    public static void main(final String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int w = sc.nextInt();
        int ar[] = new int[w];
        int n = sc.nextInt();
        for (int i = 0; i < w; i++)
            ar[i] = i + 1;
        for (int i = 0; i < n; i++) {
            String buf = sc.next();
            String buf2[] = buf.split(",");
            int a = Integer.parseInt(buf2[0]) - 1, 
                b = Integer.parseInt(buf2[1]) - 1;
            int tmp = ar[a];
            ar[a] = ar[b];
            ar[b] = tmp;
        }
        
        for (int i = 0; i < w; i++) {
            System.out.printf("%d\n", ar[i]);
        }
    }
  
}
