import java.util.Scanner;
public class Main{
    
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] stick = new int[w];
            for(int i = 0; i < stick.length; i++){
                stick[i] = i + 1;
            }
            
            int a, b;
            
            for(int i = 0; i < n; i++){
                String line = sc.next();
                String[] num = line.split(",");
                a = Integer.parseInt(num[0])-1;
                b = Integer.parseInt(num[1])-1;
                int tmp = stick[a];
                stick[a] = stick[b];
                stick[b] = tmp;
            }

            for(int i = 0; i < stick.length; i++){
                System.out.println(stick[i]);
            }
        
    }
} import java.util.Scanner; Scanner java.util public class Main{
    
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] stick = new int[w];
            for(int i = 0; i < stick.length; i++){
                stick[i] = i + 1;
            }
            
            int a, b;
            
            for(int i = 0; i < n; i++){
                String line = sc.next();
                String[] num = line.split(",");
                a = Integer.parseInt(num[0])-1;
                b = Integer.parseInt(num[1])-1;
                int tmp = stick[a];
                stick[a] = stick[b];
                stick[b] = tmp;
            }

            for(int i = 0; i < stick.length; i++){
                System.out.println(stick[i]);
            }
        
    }
} Main public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] stick = new int[w];
            for(int i = 0; i < stick.length; i++){
                stick[i] = i + 1;
            }
            
            int a, b;
            
            for(int i = 0; i < n; i++){
                String line = sc.next();
                String[] num = line.split(",");
                a = Integer.parseInt(num[0])-1;
                b = Integer.parseInt(num[1])-1;
                int tmp = stick[a];
                stick[a] = stick[b];
                stick[b] = tmp;
            }

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

        Scanner sc = new Scanner(System.in);
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] stick = new int[w];
            for(int i = 0; i < stick.length; i++){
                stick[i] = i + 1;
            }
            
            int a, b;
            
            for(int i = 0; i < n; i++){
                String line = sc.next();
                String[] num = line.split(",");
                a = Integer.parseInt(num[0])-1;
                b = Integer.parseInt(num[1])-1;
                int tmp = stick[a];
                stick[a] = stick[b];
                stick[b] = tmp;
            }

            for(int i = 0; i < stick.length; i++){
                System.out.println(stick[i]);
            }
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] stick = new int[w]; stick new int[w] w for(int i = 0; i < stick.length; i++){
                stick[i] = i + 1;
            } int i = 0; int i = 0; i 0 i < stick.length i stick.length stick stick.length i++ i++ i {
                stick[i] = i + 1;
            } {
                stick[i] = i + 1;
            } stick[i] = i + 1 stick[i] stick i i + 1 i 1 int a a b; b for(int i = 0; i < n; i++){
                String line = sc.next();
                String[] num = line.split(",");
                a = Integer.parseInt(num[0])-1;
                b = Integer.parseInt(num[1])-1;
                int tmp = stick[a];
                stick[a] = stick[b];
                stick[b] = tmp;
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                String line = sc.next();
                String[] num = line.split(",");
                a = Integer.parseInt(num[0])-1;
                b = Integer.parseInt(num[1])-1;
                int tmp = stick[a];
                stick[a] = stick[b];
                stick[b] = tmp;
            } {
                String line = sc.next();
                String[] num = line.split(",");
                a = Integer.parseInt(num[0])-1;
                b = Integer.parseInt(num[1])-1;
                int tmp = stick[a];
                stick[a] = stick[b];
                stick[b] = tmp;
            } String line = sc.next(); line sc.next() sc.next sc String[] num = line.split(","); num line.split(",") line.split line "," a = Integer.parseInt(num[0])-1 a Integer.parseInt(num[0])-1 Integer.parseInt(num[0]) Integer.parseInt Integer num[0] num 0 1 b = Integer.parseInt(num[1])-1 b Integer.parseInt(num[1])-1 Integer.parseInt(num[1]) Integer.parseInt Integer num[1] num 1 1 int tmp = stick[a]; tmp stick[a] stick a stick[a] = stick[b] stick[a] stick a stick[b] stick b stick[b] = tmp stick[b] stick b tmp for(int i = 0; i < stick.length; i++){
                System.out.println(stick[i]);
            } int i = 0; int i = 0; i 0 i < stick.length i stick.length stick stick.length i++ i++ i {
                System.out.println(stick[i]);
            } {
                System.out.println(stick[i]);
            } System.out.println(stick[i]) System.out.println System.out System System.out stick[i] stick i String[] args args public class Main{
    
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] stick = new int[w];
            for(int i = 0; i < stick.length; i++){
                stick[i] = i + 1;
            }
            
            int a, b;
            
            for(int i = 0; i < n; i++){
                String line = sc.next();
                String[] num = line.split(",");
                a = Integer.parseInt(num[0])-1;
                b = Integer.parseInt(num[1])-1;
                int tmp = stick[a];
                stick[a] = stick[b];
                stick[b] = tmp;
            }

            for(int i = 0; i < stick.length; i++){
                System.out.println(stick[i]);
            }
        
    }
} public class Main{
    
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] stick = new int[w];
            for(int i = 0; i < stick.length; i++){
                stick[i] = i + 1;
            }
            
            int a, b;
            
            for(int i = 0; i < n; i++){
                String line = sc.next();
                String[] num = line.split(",");
                a = Integer.parseInt(num[0])-1;
                b = Integer.parseInt(num[1])-1;
                int tmp = stick[a];
                stick[a] = stick[b];
                stick[b] = tmp;
            }

            for(int i = 0; i < stick.length; i++){
                System.out.println(stick[i]);
            }
        
    }
} Main
import java.util.Scanner;
public class Main{
    
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] stick = new int[w];
            for(int i = 0; i < stick.length; i++){
                stick[i] = i + 1;
            }
            
            int a, b;
            
            for(int i = 0; i < n; i++){
                String line = sc.next();
                String[] num = line.split(",");
                a = Integer.parseInt(num[0])-1;
                b = Integer.parseInt(num[1])-1;
                int tmp = stick[a];
                stick[a] = stick[b];
                stick[b] = tmp;
            }

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