import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int t=s.nextInt(),i=0,a,b,c;int[]n=new int[t];for(;i<t;)n[i]=i++;for(t=s.nextInt(),s.nextLine();t-->0;){z=s.nextLine().split(",");c=n[a=new Integer(z[0])-1];n[a]=n[b=new Integer(z[1])-1];n[b]=c;}for(int e:n)System.out.println(e+1);}} import java.util.*; util.* java class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int t=s.nextInt(),i=0,a,b,c;int[]n=new int[t];for(;i<t;)n[i]=i++;for(t=s.nextInt(),s.nextLine();t-->0;){z=s.nextLine().split(",");c=n[a=new Integer(z[0])-1];n[a]=n[b=new Integer(z[1])-1];n[b]=c;}for(int e:n)System.out.println(e+1);}} Main public static void main(String[]z){Scanner s=new Scanner(System.in);int t=s.nextInt(),i=0,a,b,c;int[]n=new int[t];for(;i<t;)n[i]=i++;for(t=s.nextInt(),s.nextLine();t-->0;){z=s.nextLine().split(",");c=n[a=new Integer(z[0])-1];n[a]=n[b=new Integer(z[1])-1];n[b]=c;}for(int e:n)System.out.println(e+1);} main {Scanner s=new Scanner(System.in);int t=s.nextInt(),i=0,a,b,c;int[]n=new int[t];for(;i<t;)n[i]=i++;for(t=s.nextInt(),s.nextLine();t-->0;){z=s.nextLine().split(",");c=n[a=new Integer(z[0])-1];n[a]=n[b=new Integer(z[1])-1];n[b]=c;}for(int e:n)System.out.println(e+1);} Scanner s=new Scanner(System.in); s new Scanner(System.in) int t=s.nextInt() t s.nextInt() s.nextInt s i=0 i 0 a a b b c; c int[]n=new int[t]; n new int[t] t for(;i<t;)n[i]=i++; ; i<t i t n[i]=i++; n[i]=i++ n[i] n i i++ i for(t=s.nextInt(),s.nextLine();t-->0;){z=s.nextLine().split(",");c=n[a=new Integer(z[0])-1];n[a]=n[b=new Integer(z[1])-1];n[b]=c;} t=s.nextInt(),s.nextLine(); t=s.nextInt() t s.nextInt() s.nextInt s s.nextLine() s.nextLine s t-->0 t-- t 0 {z=s.nextLine().split(",");c=n[a=new Integer(z[0])-1];n[a]=n[b=new Integer(z[1])-1];n[b]=c;} {z=s.nextLine().split(",");c=n[a=new Integer(z[0])-1];n[a]=n[b=new Integer(z[1])-1];n[b]=c;} z=s.nextLine().split(",") z s.nextLine().split(",") s.nextLine().split s.nextLine() s.nextLine s "," c=n[a=new Integer(z[0])-1] c n[a=new Integer(z[0])-1] n a=new Integer(z[0])-1 a new Integer(z[0])-1 new Integer(z[0]) 1 n[a]=n[b=new Integer(z[1])-1] n[a] n a n[b=new Integer(z[1])-1] n b=new Integer(z[1])-1 b new Integer(z[1])-1 new Integer(z[1]) 1 n[b]=c n[b] n b c for(int e:n)System.out.println(e+1); int e n System.out.println(e+1); System.out.println(e+1) System.out.println System.out System System.out e+1 e 1 String[]z z
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int t=s.nextInt(),i=0,a,b,c;int[]n=new int[t];for(;i<t;)n[i]=i++;for(t=s.nextInt(),s.nextLine();t-->0;){z=s.nextLine().split(",");c=n[a=new Integer(z[0])-1];n[a]=n[b=new Integer(z[1])-1];n[b]=c;}for(int e:n)System.out.println(e+1);}}