import java.util.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int stick = sc.nextInt();
        int bar = sc.nextInt();

        int[] amida = new int[stick];

        for(int i = 0; i < stick; i++){
            amida[i] = i;
        }

        for(int i = 0; i < bar; i++){
            String line = sc.next();

            int a = 0;
            int b = 0;

            int index = 0;
            for(; index < line.length(); index++){
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            }

            for(; index < line.length(); index++){
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            }

            a--;
            b--;

            int c = amida[a];
            int d = amida[b];

            amida[a] = d;
            amida[b] = c;
        }

        for(int i = 0; i < stick; i++){
            System.out.println(amida[i]+1);
        }
 
    }
} import java.util.*; util.* java import java.math.*; math.* java public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int stick = sc.nextInt();
        int bar = sc.nextInt();

        int[] amida = new int[stick];

        for(int i = 0; i < stick; i++){
            amida[i] = i;
        }

        for(int i = 0; i < bar; i++){
            String line = sc.next();

            int a = 0;
            int b = 0;

            int index = 0;
            for(; index < line.length(); index++){
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            }

            for(; index < line.length(); index++){
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            }

            a--;
            b--;

            int c = amida[a];
            int d = amida[b];

            amida[a] = d;
            amida[b] = c;
        }

        for(int i = 0; i < stick; i++){
            System.out.println(amida[i]+1);
        }
 
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int stick = sc.nextInt();
        int bar = sc.nextInt();

        int[] amida = new int[stick];

        for(int i = 0; i < stick; i++){
            amida[i] = i;
        }

        for(int i = 0; i < bar; i++){
            String line = sc.next();

            int a = 0;
            int b = 0;

            int index = 0;
            for(; index < line.length(); index++){
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            }

            for(; index < line.length(); index++){
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            }

            a--;
            b--;

            int c = amida[a];
            int d = amida[b];

            amida[a] = d;
            amida[b] = c;
        }

        for(int i = 0; i < stick; i++){
            System.out.println(amida[i]+1);
        }
 
    } main {
        Scanner sc = new Scanner(System.in);
 
        int stick = sc.nextInt();
        int bar = sc.nextInt();

        int[] amida = new int[stick];

        for(int i = 0; i < stick; i++){
            amida[i] = i;
        }

        for(int i = 0; i < bar; i++){
            String line = sc.next();

            int a = 0;
            int b = 0;

            int index = 0;
            for(; index < line.length(); index++){
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            }

            for(; index < line.length(); index++){
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            }

            a--;
            b--;

            int c = amida[a];
            int d = amida[b];

            amida[a] = d;
            amida[b] = c;
        }

        for(int i = 0; i < stick; i++){
            System.out.println(amida[i]+1);
        }
 
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int stick = sc.nextInt(); stick sc.nextInt() sc.nextInt sc int bar = sc.nextInt(); bar sc.nextInt() sc.nextInt sc int[] amida = new int[stick]; amida new int[stick] stick for(int i = 0; i < stick; i++){
            amida[i] = i;
        } int i = 0; int i = 0; i 0 i < stick i stick i++ i++ i {
            amida[i] = i;
        } {
            amida[i] = i;
        } amida[i] = i amida[i] amida i i for(int i = 0; i < bar; i++){
            String line = sc.next();

            int a = 0;
            int b = 0;

            int index = 0;
            for(; index < line.length(); index++){
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            }

            for(; index < line.length(); index++){
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            }

            a--;
            b--;

            int c = amida[a];
            int d = amida[b];

            amida[a] = d;
            amida[b] = c;
        } int i = 0; int i = 0; i 0 i < bar i bar i++ i++ i {
            String line = sc.next();

            int a = 0;
            int b = 0;

            int index = 0;
            for(; index < line.length(); index++){
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            }

            for(; index < line.length(); index++){
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            }

            a--;
            b--;

            int c = amida[a];
            int d = amida[b];

            amida[a] = d;
            amida[b] = c;
        } {
            String line = sc.next();

            int a = 0;
            int b = 0;

            int index = 0;
            for(; index < line.length(); index++){
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            }

            for(; index < line.length(); index++){
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            }

            a--;
            b--;

            int c = amida[a];
            int d = amida[b];

            amida[a] = d;
            amida[b] = c;
        } String line = sc.next(); line sc.next() sc.next sc int a = 0; a 0 int b = 0; b 0 int index = 0; index 0 for(; index < line.length(); index++){
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            } ; index < line.length() index line.length() line.length line index++ index++ index {
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            } {
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            } if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                } line.charAt(index) == ',' line.charAt(index) line.charAt line index ',' {
                    index++;
                    break;
                } index++ index break; {
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                } a *= 10 a 10 a += Integer.parseInt("" + line.charAt(index)) a Integer.parseInt("" + line.charAt(index)) Integer.parseInt Integer "" + line.charAt(index) "" line.charAt(index) line.charAt line index for(; index < line.length(); index++){
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            } ; index < line.length() index line.length() line.length line index++ index++ index {
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            } {
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            } b *= 10 b 10 b += Integer.parseInt("" + line.charAt(index)) b Integer.parseInt("" + line.charAt(index)) Integer.parseInt Integer "" + line.charAt(index) "" line.charAt(index) line.charAt line index a-- a b-- b int c = amida[a]; c amida[a] amida a int d = amida[b]; d amida[b] amida b amida[a] = d amida[a] amida a d amida[b] = c amida[b] amida b c for(int i = 0; i < stick; i++){
            System.out.println(amida[i]+1);
        } int i = 0; int i = 0; i 0 i < stick i stick i++ i++ i {
            System.out.println(amida[i]+1);
        } {
            System.out.println(amida[i]+1);
        } System.out.println(amida[i]+1) System.out.println System.out System System.out amida[i]+1 amida[i] amida i 1 String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int stick = sc.nextInt();
        int bar = sc.nextInt();

        int[] amida = new int[stick];

        for(int i = 0; i < stick; i++){
            amida[i] = i;
        }

        for(int i = 0; i < bar; i++){
            String line = sc.next();

            int a = 0;
            int b = 0;

            int index = 0;
            for(; index < line.length(); index++){
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            }

            for(; index < line.length(); index++){
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            }

            a--;
            b--;

            int c = amida[a];
            int d = amida[b];

            amida[a] = d;
            amida[b] = c;
        }

        for(int i = 0; i < stick; i++){
            System.out.println(amida[i]+1);
        }
 
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int stick = sc.nextInt();
        int bar = sc.nextInt();

        int[] amida = new int[stick];

        for(int i = 0; i < stick; i++){
            amida[i] = i;
        }

        for(int i = 0; i < bar; i++){
            String line = sc.next();

            int a = 0;
            int b = 0;

            int index = 0;
            for(; index < line.length(); index++){
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            }

            for(; index < line.length(); index++){
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            }

            a--;
            b--;

            int c = amida[a];
            int d = amida[b];

            amida[a] = d;
            amida[b] = c;
        }

        for(int i = 0; i < stick; i++){
            System.out.println(amida[i]+1);
        }
 
    }
} Main
import java.util.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int stick = sc.nextInt();
        int bar = sc.nextInt();

        int[] amida = new int[stick];

        for(int i = 0; i < stick; i++){
            amida[i] = i;
        }

        for(int i = 0; i < bar; i++){
            String line = sc.next();

            int a = 0;
            int b = 0;

            int index = 0;
            for(; index < line.length(); index++){
                if(line.charAt(index) == ','){
                    index++;
                    break;
                }else{
                    a *= 10;
                    a += Integer.parseInt("" + line.charAt(index));
                }
            }

            for(; index < line.length(); index++){
                b *= 10;
                b += Integer.parseInt("" + line.charAt(index));
            }

            a--;
            b--;

            int c = amida[a];
            int d = amida[b];

            amida[a] = d;
            amida[b] = c;
        }

        for(int i = 0; i < stick; i++){
            System.out.println(amida[i]+1);
        }
 
    }
}