import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        int w = scn.nextInt(), n = scn.nextInt();
        int[] ary = createArray(w);
        scn.useDelimiter("\\s+|,");
        for(int i = 0; i < n; i++) {
            swapArray(ary, scn.nextInt() - 1, scn.nextInt() - 1);
        }
        showArray(ary);
    }
    
    private static int[] createArray(int w) {
        int[] ary = new int[w];
        for(int i = 0; i < w; i++) {
            ary[i] = i + 1;
        }
        return ary;
    }
    
    private static void swapArray(int[] ary, int x, int y) {
        ary[x] ^= ary[y];
        ary[y] ^= ary[x];
        ary[x] ^= ary[y];
    }
    
    private static void showArray(int[] ary) {
        for(int elm : ary) {
            System.out.println(elm);
        }
    }
} import java.util.*; util.* java public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        int w = scn.nextInt(), n = scn.nextInt();
        int[] ary = createArray(w);
        scn.useDelimiter("\\s+|,");
        for(int i = 0; i < n; i++) {
            swapArray(ary, scn.nextInt() - 1, scn.nextInt() - 1);
        }
        showArray(ary);
    }
    
    private static int[] createArray(int w) {
        int[] ary = new int[w];
        for(int i = 0; i < w; i++) {
            ary[i] = i + 1;
        }
        return ary;
    }
    
    private static void swapArray(int[] ary, int x, int y) {
        ary[x] ^= ary[y];
        ary[y] ^= ary[x];
        ary[x] ^= ary[y];
    }
    
    private static void showArray(int[] ary) {
        for(int elm : ary) {
            System.out.println(elm);
        }
    }
} Main private static final Scanner scn = new Scanner(System.in); scn new Scanner(System.in) public static void main(String[] args) {
        int w = scn.nextInt(), n = scn.nextInt();
        int[] ary = createArray(w);
        scn.useDelimiter("\\s+|,");
        for(int i = 0; i < n; i++) {
            swapArray(ary, scn.nextInt() - 1, scn.nextInt() - 1);
        }
        showArray(ary);
    } main {
        int w = scn.nextInt(), n = scn.nextInt();
        int[] ary = createArray(w);
        scn.useDelimiter("\\s+|,");
        for(int i = 0; i < n; i++) {
            swapArray(ary, scn.nextInt() - 1, scn.nextInt() - 1);
        }
        showArray(ary);
    } int w = scn.nextInt() w scn.nextInt() scn.nextInt scn n = scn.nextInt(); n scn.nextInt() scn.nextInt scn int[] ary = createArray(w); ary createArray(w) createArray w scn.useDelimiter("\\s+|,") scn.useDelimiter scn "\\s+|," for(int i = 0; i < n; i++) {
            swapArray(ary, scn.nextInt() - 1, scn.nextInt() - 1);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            swapArray(ary, scn.nextInt() - 1, scn.nextInt() - 1);
        } {
            swapArray(ary, scn.nextInt() - 1, scn.nextInt() - 1);
        } swapArray(ary, scn.nextInt() - 1, scn.nextInt() - 1) swapArray ary scn.nextInt() - 1 scn.nextInt() scn.nextInt scn 1 scn.nextInt() - 1 scn.nextInt() scn.nextInt scn 1 showArray(ary) showArray ary String[] args args private static int[] createArray(int w) {
        int[] ary = new int[w];
        for(int i = 0; i < w; i++) {
            ary[i] = i + 1;
        }
        return ary;
    } createArray {
        int[] ary = new int[w];
        for(int i = 0; i < w; i++) {
            ary[i] = i + 1;
        }
        return ary;
    } int[] ary = new int[w]; ary new int[w] w for(int i = 0; i < w; i++) {
            ary[i] = i + 1;
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            ary[i] = i + 1;
        } {
            ary[i] = i + 1;
        } ary[i] = i + 1 ary[i] ary i i + 1 i 1 return ary; ary int w w private static void swapArray(int[] ary, int x, int y) {
        ary[x] ^= ary[y];
        ary[y] ^= ary[x];
        ary[x] ^= ary[y];
    } swapArray {
        ary[x] ^= ary[y];
        ary[y] ^= ary[x];
        ary[x] ^= ary[y];
    } ary[x] ^= ary[y] ary[x] ary x ary[y] ary y ary[y] ^= ary[x] ary[y] ary y ary[x] ary x ary[x] ^= ary[y] ary[x] ary x ary[y] ary y int[] ary ary int x x int y y private static void showArray(int[] ary) {
        for(int elm : ary) {
            System.out.println(elm);
        }
    } showArray {
        for(int elm : ary) {
            System.out.println(elm);
        }
    } for(int elm : ary) {
            System.out.println(elm);
        } int elm ary {
            System.out.println(elm);
        } {
            System.out.println(elm);
        } System.out.println(elm) System.out.println System.out System System.out elm int[] ary ary public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        int w = scn.nextInt(), n = scn.nextInt();
        int[] ary = createArray(w);
        scn.useDelimiter("\\s+|,");
        for(int i = 0; i < n; i++) {
            swapArray(ary, scn.nextInt() - 1, scn.nextInt() - 1);
        }
        showArray(ary);
    }
    
    private static int[] createArray(int w) {
        int[] ary = new int[w];
        for(int i = 0; i < w; i++) {
            ary[i] = i + 1;
        }
        return ary;
    }
    
    private static void swapArray(int[] ary, int x, int y) {
        ary[x] ^= ary[y];
        ary[y] ^= ary[x];
        ary[x] ^= ary[y];
    }
    
    private static void showArray(int[] ary) {
        for(int elm : ary) {
            System.out.println(elm);
        }
    }
} public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        int w = scn.nextInt(), n = scn.nextInt();
        int[] ary = createArray(w);
        scn.useDelimiter("\\s+|,");
        for(int i = 0; i < n; i++) {
            swapArray(ary, scn.nextInt() - 1, scn.nextInt() - 1);
        }
        showArray(ary);
    }
    
    private static int[] createArray(int w) {
        int[] ary = new int[w];
        for(int i = 0; i < w; i++) {
            ary[i] = i + 1;
        }
        return ary;
    }
    
    private static void swapArray(int[] ary, int x, int y) {
        ary[x] ^= ary[y];
        ary[y] ^= ary[x];
        ary[x] ^= ary[y];
    }
    
    private static void showArray(int[] ary) {
        for(int elm : ary) {
            System.out.println(elm);
        }
    }
} Main
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        int w = scn.nextInt(), n = scn.nextInt();
        int[] ary = createArray(w);
        scn.useDelimiter("\\s+|,");
        for(int i = 0; i < n; i++) {
            swapArray(ary, scn.nextInt() - 1, scn.nextInt() - 1);
        }
        showArray(ary);
    }
    
    private static int[] createArray(int w) {
        int[] ary = new int[w];
        for(int i = 0; i < w; i++) {
            ary[i] = i + 1;
        }
        return ary;
    }
    
    private static void swapArray(int[] ary, int x, int y) {
        ary[x] ^= ary[y];
        ary[y] ^= ary[x];
        ary[x] ^= ary[y];
    }
    
    private static void showArray(int[] ary) {
        for(int elm : ary) {
            System.out.println(elm);
        }
    }
}