import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {

        static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        public static void main(String[] args) throws Exception{

            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());

            int[] seq = new int[w];
            for (int i=0; i<w; i++)
                seq[i] = i+1;

            while (n-- > 0) {
                String[] s  = reader.readLine().split(",");
                int begin = Integer.parseInt(s[0]) - 1;
                int end = Integer.parseInt(s[1]) - 1;

                int tmp = seq[begin];
                seq[begin] = seq[end];
                seq[end] = tmp;
            }

            for (int i=0; i<w; i++)
                System.out.println(seq[i]);
        }

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {

        static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        public static void main(String[] args) throws Exception{

            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());

            int[] seq = new int[w];
            for (int i=0; i<w; i++)
                seq[i] = i+1;

            while (n-- > 0) {
                String[] s  = reader.readLine().split(",");
                int begin = Integer.parseInt(s[0]) - 1;
                int end = Integer.parseInt(s[1]) - 1;

                int tmp = seq[begin];
                seq[begin] = seq[end];
                seq[end] = tmp;
            }

            for (int i=0; i<w; i++)
                System.out.println(seq[i]);
        }

} Main static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) public static void main(String[] args) throws Exception{

            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());

            int[] seq = new int[w];
            for (int i=0; i<w; i++)
                seq[i] = i+1;

            while (n-- > 0) {
                String[] s  = reader.readLine().split(",");
                int begin = Integer.parseInt(s[0]) - 1;
                int end = Integer.parseInt(s[1]) - 1;

                int tmp = seq[begin];
                seq[begin] = seq[end];
                seq[end] = tmp;
            }

            for (int i=0; i<w; i++)
                System.out.println(seq[i]);
        } main {

            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());

            int[] seq = new int[w];
            for (int i=0; i<w; i++)
                seq[i] = i+1;

            while (n-- > 0) {
                String[] s  = reader.readLine().split(",");
                int begin = Integer.parseInt(s[0]) - 1;
                int end = Integer.parseInt(s[1]) - 1;

                int tmp = seq[begin];
                seq[begin] = seq[end];
                seq[end] = tmp;
            }

            for (int i=0; i<w; i++)
                System.out.println(seq[i]);
        } int w = Integer.parseInt(reader.readLine()); w Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int n = Integer.parseInt(reader.readLine()); n Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int[] seq = new int[w]; seq new int[w] w for (int i=0; i<w; i++)
                seq[i] = i+1; int i=0; int i=0; i 0 i<w i w i++ i++ i seq[i] = i+1; seq[i] = i+1 seq[i] seq i i+1 i 1 while (n-- > 0) {
                String[] s  = reader.readLine().split(",");
                int begin = Integer.parseInt(s[0]) - 1;
                int end = Integer.parseInt(s[1]) - 1;

                int tmp = seq[begin];
                seq[begin] = seq[end];
                seq[end] = tmp;
            } n-- > 0 n-- n 0 {
                String[] s  = reader.readLine().split(",");
                int begin = Integer.parseInt(s[0]) - 1;
                int end = Integer.parseInt(s[1]) - 1;

                int tmp = seq[begin];
                seq[begin] = seq[end];
                seq[end] = tmp;
            } String[] s  = reader.readLine().split(","); s reader.readLine().split(",") reader.readLine().split reader.readLine() reader.readLine reader "," int begin = Integer.parseInt(s[0]) - 1; begin Integer.parseInt(s[0]) - 1 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 1 int end = Integer.parseInt(s[1]) - 1; end Integer.parseInt(s[1]) - 1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 1 int tmp = seq[begin]; tmp seq[begin] seq begin seq[begin] = seq[end] seq[begin] seq begin seq[end] seq end seq[end] = tmp seq[end] seq end tmp for (int i=0; i<w; i++)
                System.out.println(seq[i]); int i=0; int i=0; i 0 i<w i w i++ i++ i System.out.println(seq[i]); System.out.println(seq[i]) System.out.println System.out System System.out seq[i] seq i String[] args args
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {

        static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        public static void main(String[] args) throws Exception{

            int w = Integer.parseInt(reader.readLine());
            int n = Integer.parseInt(reader.readLine());

            int[] seq = new int[w];
            for (int i=0; i<w; i++)
                seq[i] = i+1;

            while (n-- > 0) {
                String[] s  = reader.readLine().split(",");
                int begin = Integer.parseInt(s[0]) - 1;
                int end = Integer.parseInt(s[1]) - 1;

                int tmp = seq[begin];
                seq[begin] = seq[end];
                seq[end] = tmp;
            }

            for (int i=0; i<w; i++)
                System.out.println(seq[i]);
        }

}