import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int w = Integer.parseInt(scanner.nextLine());
        int n = Integer.parseInt(scanner.nextLine());
        int a[] = new int[n];
        int b[] = new int[n];
        int z[] = new int[w];
        for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();
            String t[] = s.split(",");
            a[i] = Integer.parseInt(t[0]);
            b[i] = Integer.parseInt(t[1]);
        }
        for (int i = 0; i < w; i++) {
            int p = i + 1;
            for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            }
            z[p-1] = i + 1;
        }
        for (int i = 0; i < w; i++) {
            System.out.println(z[i]);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int w = Integer.parseInt(scanner.nextLine());
        int n = Integer.parseInt(scanner.nextLine());
        int a[] = new int[n];
        int b[] = new int[n];
        int z[] = new int[w];
        for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();
            String t[] = s.split(",");
            a[i] = Integer.parseInt(t[0]);
            b[i] = Integer.parseInt(t[1]);
        }
        for (int i = 0; i < w; i++) {
            int p = i + 1;
            for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            }
            z[p-1] = i + 1;
        }
        for (int i = 0; i < w; i++) {
            System.out.println(z[i]);
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int w = Integer.parseInt(scanner.nextLine());
        int n = Integer.parseInt(scanner.nextLine());
        int a[] = new int[n];
        int b[] = new int[n];
        int z[] = new int[w];
        for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();
            String t[] = s.split(",");
            a[i] = Integer.parseInt(t[0]);
            b[i] = Integer.parseInt(t[1]);
        }
        for (int i = 0; i < w; i++) {
            int p = i + 1;
            for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            }
            z[p-1] = i + 1;
        }
        for (int i = 0; i < w; i++) {
            System.out.println(z[i]);
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        int w = Integer.parseInt(scanner.nextLine());
        int n = Integer.parseInt(scanner.nextLine());
        int a[] = new int[n];
        int b[] = new int[n];
        int z[] = new int[w];
        for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();
            String t[] = s.split(",");
            a[i] = Integer.parseInt(t[0]);
            b[i] = Integer.parseInt(t[1]);
        }
        for (int i = 0; i < w; i++) {
            int p = i + 1;
            for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            }
            z[p-1] = i + 1;
        }
        for (int i = 0; i < w; i++) {
            System.out.println(z[i]);
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int w = Integer.parseInt(scanner.nextLine()); w Integer.parseInt(scanner.nextLine()) Integer.parseInt Integer scanner.nextLine() scanner.nextLine scanner int n = Integer.parseInt(scanner.nextLine()); n Integer.parseInt(scanner.nextLine()) Integer.parseInt Integer scanner.nextLine() scanner.nextLine scanner int a[] = new int[n]; a new int[n] n int b[] = new int[n]; b new int[n] n int z[] = new int[w]; z new int[w] w for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();
            String t[] = s.split(",");
            a[i] = Integer.parseInt(t[0]);
            b[i] = Integer.parseInt(t[1]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String s = scanner.nextLine();
            String t[] = s.split(",");
            a[i] = Integer.parseInt(t[0]);
            b[i] = Integer.parseInt(t[1]);
        } {
            String s = scanner.nextLine();
            String t[] = s.split(",");
            a[i] = Integer.parseInt(t[0]);
            b[i] = Integer.parseInt(t[1]);
        } String s = scanner.nextLine(); s scanner.nextLine() scanner.nextLine scanner String t[] = s.split(","); t s.split(",") s.split s "," a[i] = Integer.parseInt(t[0]) a[i] a i Integer.parseInt(t[0]) Integer.parseInt Integer t[0] t 0 b[i] = Integer.parseInt(t[1]) b[i] b i Integer.parseInt(t[1]) Integer.parseInt Integer t[1] t 1 for (int i = 0; i < w; i++) {
            int p = i + 1;
            for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            }
            z[p-1] = i + 1;
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            int p = i + 1;
            for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            }
            z[p-1] = i + 1;
        } {
            int p = i + 1;
            for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            }
            z[p-1] = i + 1;
        } int p = i + 1; p i + 1 i 1 for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            } {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            } if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                } p == a[j] p a[j] a j {
                    p = b[j];
                } p = b[j] p b[j] b j if (p == b[j]) {
                    p = a[j];
                } p == b[j] p b[j] b j {
                    p = a[j];
                } p = a[j] p a[j] a j z[p-1] = i + 1 z[p-1] z p-1 p 1 i + 1 i 1 for (int i = 0; i < w; i++) {
            System.out.println(z[i]);
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            System.out.println(z[i]);
        } {
            System.out.println(z[i]);
        } System.out.println(z[i]) System.out.println System.out System System.out z[i] z i String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int w = Integer.parseInt(scanner.nextLine());
        int n = Integer.parseInt(scanner.nextLine());
        int a[] = new int[n];
        int b[] = new int[n];
        int z[] = new int[w];
        for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();
            String t[] = s.split(",");
            a[i] = Integer.parseInt(t[0]);
            b[i] = Integer.parseInt(t[1]);
        }
        for (int i = 0; i < w; i++) {
            int p = i + 1;
            for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            }
            z[p-1] = i + 1;
        }
        for (int i = 0; i < w; i++) {
            System.out.println(z[i]);
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int w = Integer.parseInt(scanner.nextLine());
        int n = Integer.parseInt(scanner.nextLine());
        int a[] = new int[n];
        int b[] = new int[n];
        int z[] = new int[w];
        for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();
            String t[] = s.split(",");
            a[i] = Integer.parseInt(t[0]);
            b[i] = Integer.parseInt(t[1]);
        }
        for (int i = 0; i < w; i++) {
            int p = i + 1;
            for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            }
            z[p-1] = i + 1;
        }
        for (int i = 0; i < w; i++) {
            System.out.println(z[i]);
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int w = Integer.parseInt(scanner.nextLine());
        int n = Integer.parseInt(scanner.nextLine());
        int a[] = new int[n];
        int b[] = new int[n];
        int z[] = new int[w];
        for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();
            String t[] = s.split(",");
            a[i] = Integer.parseInt(t[0]);
            b[i] = Integer.parseInt(t[1]);
        }
        for (int i = 0; i < w; i++) {
            int p = i + 1;
            for (int j = 0; j < n; j++) {
                if (p == a[j]) {
                    p = b[j];
                } else if (p == b[j]) {
                    p = a[j];
                }
            }
            z[p-1] = i + 1;
        }
        for (int i = 0; i < w; i++) {
            System.out.println(z[i]);
        }
    }
}
