import java.util.*;
class Main{

    public static void main(String args[]){
	int w,n;
	int[][] Edge;
	int[] Ans;
	Scanner in = new Scanner(System.in);
	String[] s;

	w = in.nextInt();
	n = in.nextInt();
	Edge = new int[w+1][2];
	Ans = new int[w+1];
	for(int i=0;i<n;i++){
	    s = in.next().split(",");
	    Edge[i][0] = Integer.valueOf(s[0]).intValue();
	    Edge[i][1] = Integer.valueOf(s[1]).intValue();	   
	}
    
	int here;
	for(int i=1;i<=w;i++){
	    here = i;
	    for(int j=0;j<w;j++){
		if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0];
	    }
	    Ans[here-1] = i;
	}

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

    }



} import java.util.*; util.* java class Main{

    public static void main(String args[]){
	int w,n;
	int[][] Edge;
	int[] Ans;
	Scanner in = new Scanner(System.in);
	String[] s;

	w = in.nextInt();
	n = in.nextInt();
	Edge = new int[w+1][2];
	Ans = new int[w+1];
	for(int i=0;i<n;i++){
	    s = in.next().split(",");
	    Edge[i][0] = Integer.valueOf(s[0]).intValue();
	    Edge[i][1] = Integer.valueOf(s[1]).intValue();	   
	}
    
	int here;
	for(int i=1;i<=w;i++){
	    here = i;
	    for(int j=0;j<w;j++){
		if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0];
	    }
	    Ans[here-1] = i;
	}

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

    }



} Main public static void main(String args[]){
	int w,n;
	int[][] Edge;
	int[] Ans;
	Scanner in = new Scanner(System.in);
	String[] s;

	w = in.nextInt();
	n = in.nextInt();
	Edge = new int[w+1][2];
	Ans = new int[w+1];
	for(int i=0;i<n;i++){
	    s = in.next().split(",");
	    Edge[i][0] = Integer.valueOf(s[0]).intValue();
	    Edge[i][1] = Integer.valueOf(s[1]).intValue();	   
	}
    
	int here;
	for(int i=1;i<=w;i++){
	    here = i;
	    for(int j=0;j<w;j++){
		if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0];
	    }
	    Ans[here-1] = i;
	}

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

    } main {
	int w,n;
	int[][] Edge;
	int[] Ans;
	Scanner in = new Scanner(System.in);
	String[] s;

	w = in.nextInt();
	n = in.nextInt();
	Edge = new int[w+1][2];
	Ans = new int[w+1];
	for(int i=0;i<n;i++){
	    s = in.next().split(",");
	    Edge[i][0] = Integer.valueOf(s[0]).intValue();
	    Edge[i][1] = Integer.valueOf(s[1]).intValue();	   
	}
    
	int here;
	for(int i=1;i<=w;i++){
	    here = i;
	    for(int j=0;j<w;j++){
		if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0];
	    }
	    Ans[here-1] = i;
	}

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

    } int w w n; n int[][] Edge; Edge int[] Ans; Ans Scanner in = new Scanner(System.in); in new Scanner(System.in) String[] s; s w = in.nextInt() w in.nextInt() in.nextInt in n = in.nextInt() n in.nextInt() in.nextInt in Edge = new int[w+1][2] Edge new int[w+1][2] w+1 w 1 2 Ans = new int[w+1] Ans new int[w+1] w+1 w 1 for(int i=0;i<n;i++){
	    s = in.next().split(",");
	    Edge[i][0] = Integer.valueOf(s[0]).intValue();
	    Edge[i][1] = Integer.valueOf(s[1]).intValue();	   
	} int i=0; int i=0; i 0 i<n i n i++ i++ i {
	    s = in.next().split(",");
	    Edge[i][0] = Integer.valueOf(s[0]).intValue();
	    Edge[i][1] = Integer.valueOf(s[1]).intValue();	   
	} {
	    s = in.next().split(",");
	    Edge[i][0] = Integer.valueOf(s[0]).intValue();
	    Edge[i][1] = Integer.valueOf(s[1]).intValue();	   
	} s = in.next().split(",") s in.next().split(",") in.next().split in.next() in.next in "," Edge[i][0] = Integer.valueOf(s[0]).intValue() Edge[i][0] Edge[i] Edge i 0 Integer.valueOf(s[0]).intValue() Integer.valueOf(s[0]).intValue Integer.valueOf(s[0]) Integer.valueOf Integer s[0] s 0 Edge[i][1] = Integer.valueOf(s[1]).intValue() Edge[i][1] Edge[i] Edge i 1 Integer.valueOf(s[1]).intValue() Integer.valueOf(s[1]).intValue Integer.valueOf(s[1]) Integer.valueOf Integer s[1] s 1 int here; here for(int i=1;i<=w;i++){
	    here = i;
	    for(int j=0;j<w;j++){
		if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0];
	    }
	    Ans[here-1] = i;
	} int i=1; int i=1; i 1 i<=w i w i++ i++ i {
	    here = i;
	    for(int j=0;j<w;j++){
		if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0];
	    }
	    Ans[here-1] = i;
	} {
	    here = i;
	    for(int j=0;j<w;j++){
		if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0];
	    }
	    Ans[here-1] = i;
	} here = i here i for(int j=0;j<w;j++){
		if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0];
	    } int j=0; int j=0; j 0 j<w j w j++ j++ j {
		if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0];
	    } {
		if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0];
	    } if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0]; Edge[j][0] == here Edge[j][0] Edge[j] Edge j 0 here here = Edge[j][1] here Edge[j][1] Edge[j] Edge j 1 if(Edge[j][1] == here)here = Edge[j][0]; Edge[j][1] == here Edge[j][1] Edge[j] Edge j 1 here here = Edge[j][0] here Edge[j][0] Edge[j] Edge j 0 Ans[here-1] = i Ans[here-1] Ans here-1 here 1 i for(int i=0;i<w;i++)System.out.println(Ans[i]); int i=0; int i=0; i 0 i<w i w i++ i++ i System.out.println(Ans[i]); System.out.println(Ans[i]) System.out.println System.out System System.out Ans[i] Ans i String args[] args
import java.util.*;
class Main{

    public static void main(String args[]){
	int w,n;
	int[][] Edge;
	int[] Ans;
	Scanner in = new Scanner(System.in);
	String[] s;

	w = in.nextInt();
	n = in.nextInt();
	Edge = new int[w+1][2];
	Ans = new int[w+1];
	for(int i=0;i<n;i++){
	    s = in.next().split(",");
	    Edge[i][0] = Integer.valueOf(s[0]).intValue();
	    Edge[i][1] = Integer.valueOf(s[1]).intValue();	   
	}
    
	int here;
	for(int i=1;i<=w;i++){
	    here = i;
	    for(int j=0;j<w;j++){
		if(Edge[j][0] == here)here = Edge[j][1];
		else if(Edge[j][1] == here)here = Edge[j][0];
	    }
	    Ans[here-1] = i;
	}

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

    }



}