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