import java.util.Scanner;
 
public class Main {
	static int[]z;
    public static int a,b,n,w,t;
	private static Scanner sc;
    public static void main(String[] args) {
        sc = new Scanner(System.in);
        w=sc.nextInt();
        n=sc.nextInt();
        z = new int[w];
        mmm();
        for(int i=0;i<w;i++)
            System.out.println(z[i]);
            }
    static void mmm(){
    	   for(int i=0;i<w;i++){
               z[i] = i+ 1;
           }
    	for(int i= 0; i< n; i++) {
            String mm= sc.next();
            String[] a1 = mm.split(",");
            a = Integer.parseInt(a1[0]) -1;
            b = Integer.parseInt(a1[1]) -1;
            t=z[a];
            z[a]=z[b];
            z[b]=t;
        }
    	
    	
    }
    } import java.util.Scanner; Scanner java.util public class Main {
	static int[]z;
    public static int a,b,n,w,t;
	private static Scanner sc;
    public static void main(String[] args) {
        sc = new Scanner(System.in);
        w=sc.nextInt();
        n=sc.nextInt();
        z = new int[w];
        mmm();
        for(int i=0;i<w;i++)
            System.out.println(z[i]);
            }
    static void mmm(){
    	   for(int i=0;i<w;i++){
               z[i] = i+ 1;
           }
    	for(int i= 0; i< n; i++) {
            String mm= sc.next();
            String[] a1 = mm.split(",");
            a = Integer.parseInt(a1[0]) -1;
            b = Integer.parseInt(a1[1]) -1;
            t=z[a];
            z[a]=z[b];
            z[b]=t;
        }
    	
    	
    }
    } Main static int[]z; z public static int a a b b n n w w t; t private static Scanner sc; sc public static void main(String[] args) {
        sc = new Scanner(System.in);
        w=sc.nextInt();
        n=sc.nextInt();
        z = new int[w];
        mmm();
        for(int i=0;i<w;i++)
            System.out.println(z[i]);
            } main {
        sc = new Scanner(System.in);
        w=sc.nextInt();
        n=sc.nextInt();
        z = new int[w];
        mmm();
        for(int i=0;i<w;i++)
            System.out.println(z[i]);
            } sc = new Scanner(System.in) sc new Scanner(System.in) w=sc.nextInt() w sc.nextInt() sc.nextInt sc n=sc.nextInt() n sc.nextInt() sc.nextInt sc z = new int[w] z new int[w] w mmm() mmm 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 System.out System System.out z[i] z i String[] args args static void mmm(){
    	   for(int i=0;i<w;i++){
               z[i] = i+ 1;
           }
    	for(int i= 0; i< n; i++) {
            String mm= sc.next();
            String[] a1 = mm.split(",");
            a = Integer.parseInt(a1[0]) -1;
            b = Integer.parseInt(a1[1]) -1;
            t=z[a];
            z[a]=z[b];
            z[b]=t;
        }
    	
    	
    } mmm {
    	   for(int i=0;i<w;i++){
               z[i] = i+ 1;
           }
    	for(int i= 0; i< n; i++) {
            String mm= sc.next();
            String[] a1 = mm.split(",");
            a = Integer.parseInt(a1[0]) -1;
            b = Integer.parseInt(a1[1]) -1;
            t=z[a];
            z[a]=z[b];
            z[b]=t;
        }
    	
    	
    } for(int i=0;i<w;i++){
               z[i] = i+ 1;
           } int i=0; int i=0; i 0 i<w i w i++ i++ i {
               z[i] = i+ 1;
           } {
               z[i] = i+ 1;
           } z[i] = i+ 1 z[i] z i i+ 1 i 1 for(int i= 0; i< n; i++) {
            String mm= sc.next();
            String[] a1 = mm.split(",");
            a = Integer.parseInt(a1[0]) -1;
            b = Integer.parseInt(a1[1]) -1;
            t=z[a];
            z[a]=z[b];
            z[b]=t;
        } int i= 0; int i= 0; i 0 i< n i n i++ i++ i {
            String mm= sc.next();
            String[] a1 = mm.split(",");
            a = Integer.parseInt(a1[0]) -1;
            b = Integer.parseInt(a1[1]) -1;
            t=z[a];
            z[a]=z[b];
            z[b]=t;
        } {
            String mm= sc.next();
            String[] a1 = mm.split(",");
            a = Integer.parseInt(a1[0]) -1;
            b = Integer.parseInt(a1[1]) -1;
            t=z[a];
            z[a]=z[b];
            z[b]=t;
        } String mm= sc.next(); mm sc.next() sc.next sc String[] a1 = mm.split(","); a1 mm.split(",") mm.split mm "," a = Integer.parseInt(a1[0]) -1 a Integer.parseInt(a1[0]) -1 Integer.parseInt(a1[0]) Integer.parseInt Integer a1[0] a1 0 1 b = Integer.parseInt(a1[1]) -1 b Integer.parseInt(a1[1]) -1 Integer.parseInt(a1[1]) Integer.parseInt Integer a1[1] a1 1 1 t=z[a] t z[a] z a z[a]=z[b] z[a] z a z[b] z b z[b]=t z[b] z b t public class Main {
	static int[]z;
    public static int a,b,n,w,t;
	private static Scanner sc;
    public static void main(String[] args) {
        sc = new Scanner(System.in);
        w=sc.nextInt();
        n=sc.nextInt();
        z = new int[w];
        mmm();
        for(int i=0;i<w;i++)
            System.out.println(z[i]);
            }
    static void mmm(){
    	   for(int i=0;i<w;i++){
               z[i] = i+ 1;
           }
    	for(int i= 0; i< n; i++) {
            String mm= sc.next();
            String[] a1 = mm.split(",");
            a = Integer.parseInt(a1[0]) -1;
            b = Integer.parseInt(a1[1]) -1;
            t=z[a];
            z[a]=z[b];
            z[b]=t;
        }
    	
    	
    }
    } public class Main {
	static int[]z;
    public static int a,b,n,w,t;
	private static Scanner sc;
    public static void main(String[] args) {
        sc = new Scanner(System.in);
        w=sc.nextInt();
        n=sc.nextInt();
        z = new int[w];
        mmm();
        for(int i=0;i<w;i++)
            System.out.println(z[i]);
            }
    static void mmm(){
    	   for(int i=0;i<w;i++){
               z[i] = i+ 1;
           }
    	for(int i= 0; i< n; i++) {
            String mm= sc.next();
            String[] a1 = mm.split(",");
            a = Integer.parseInt(a1[0]) -1;
            b = Integer.parseInt(a1[1]) -1;
            t=z[a];
            z[a]=z[b];
            z[b]=t;
        }
    	
    	
    }
    } Main
import java.util.Scanner;
 
public class Main {
	static int[]z;
    public static int a,b,n,w,t;
	private static Scanner sc;
    public static void main(String[] args) {
        sc = new Scanner(System.in);
        w=sc.nextInt();
        n=sc.nextInt();
        z = new int[w];
        mmm();
        for(int i=0;i<w;i++)
            System.out.println(z[i]);
            }
    static void mmm(){
    	   for(int i=0;i<w;i++){
               z[i] = i+ 1;
           }
    	for(int i= 0; i< n; i++) {
            String mm= sc.next();
            String[] a1 = mm.split(",");
            a = Integer.parseInt(a1[0]) -1;
            b = Integer.parseInt(a1[1]) -1;
            t=z[a];
            z[a]=z[b];
            z[b]=t;
        }
    	
    	
    }
    }