import java.io.*;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int l=Integer.parseInt(s.nextLine())+1;
		int x=Integer.parseInt(s.nextLine());
		int[] p = new int[l];
		for(int i=0;i<l;i++)p[i]=i;
		while(x-->0){String str=s.nextLine();int a= Integer.parseInt(str.split(",")[0]);int b= Integer.parseInt(str.split(",")[1]);int t=p[a];p[a]=p[b];p[b]=t;}
		for(int i=1;i<l;i++)System.out.println(p[i]);
	}
} import java.io.*; io.* java import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int l=Integer.parseInt(s.nextLine())+1;
		int x=Integer.parseInt(s.nextLine());
		int[] p = new int[l];
		for(int i=0;i<l;i++)p[i]=i;
		while(x-->0){String str=s.nextLine();int a= Integer.parseInt(str.split(",")[0]);int b= Integer.parseInt(str.split(",")[1]);int t=p[a];p[a]=p[b];p[b]=t;}
		for(int i=1;i<l;i++)System.out.println(p[i]);
	}
} Main public static void main(String[] args) {
		Scanner s = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int l=Integer.parseInt(s.nextLine())+1;
		int x=Integer.parseInt(s.nextLine());
		int[] p = new int[l];
		for(int i=0;i<l;i++)p[i]=i;
		while(x-->0){String str=s.nextLine();int a= Integer.parseInt(str.split(",")[0]);int b= Integer.parseInt(str.split(",")[1]);int t=p[a];p[a]=p[b];p[b]=t;}
		for(int i=1;i<l;i++)System.out.println(p[i]);
	} main {
		Scanner s = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int l=Integer.parseInt(s.nextLine())+1;
		int x=Integer.parseInt(s.nextLine());
		int[] p = new int[l];
		for(int i=0;i<l;i++)p[i]=i;
		while(x-->0){String str=s.nextLine();int a= Integer.parseInt(str.split(",")[0]);int b= Integer.parseInt(str.split(",")[1]);int t=p[a];p[a]=p[b];p[b]=t;}
		for(int i=1;i<l;i++)System.out.println(p[i]);
	} Scanner s = new Scanner(new BufferedReader(new InputStreamReader(System.in))); s new Scanner(new BufferedReader(new InputStreamReader(System.in))) int l=Integer.parseInt(s.nextLine())+1; l Integer.parseInt(s.nextLine())+1 Integer.parseInt(s.nextLine()) Integer.parseInt Integer s.nextLine() s.nextLine s 1 int x=Integer.parseInt(s.nextLine()); x Integer.parseInt(s.nextLine()) Integer.parseInt Integer s.nextLine() s.nextLine s int[] p = new int[l]; p new int[l] l for(int i=0;i<l;i++)p[i]=i; int i=0; int i=0; i 0 i<l i l i++ i++ i p[i]=i; p[i]=i p[i] p i i while(x-->0){String str=s.nextLine();int a= Integer.parseInt(str.split(",")[0]);int b= Integer.parseInt(str.split(",")[1]);int t=p[a];p[a]=p[b];p[b]=t;} x-->0 x-- x 0 {String str=s.nextLine();int a= Integer.parseInt(str.split(",")[0]);int b= Integer.parseInt(str.split(",")[1]);int t=p[a];p[a]=p[b];p[b]=t;} String str=s.nextLine(); str s.nextLine() s.nextLine s int a= Integer.parseInt(str.split(",")[0]); a Integer.parseInt(str.split(",")[0]) Integer.parseInt Integer str.split(",")[0] str.split(",") str.split str "," 0 int b= Integer.parseInt(str.split(",")[1]); b Integer.parseInt(str.split(",")[1]) Integer.parseInt Integer str.split(",")[1] str.split(",") str.split str "," 1 int t=p[a]; t p[a] p a p[a]=p[b] p[a] p a p[b] p b p[b]=t p[b] p b t for(int i=1;i<l;i++)System.out.println(p[i]); int i=1; int i=1; i 1 i<l i l i++ i++ i System.out.println(p[i]); System.out.println(p[i]) System.out.println System.out System System.out p[i] p i String[] args args public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int l=Integer.parseInt(s.nextLine())+1;
		int x=Integer.parseInt(s.nextLine());
		int[] p = new int[l];
		for(int i=0;i<l;i++)p[i]=i;
		while(x-->0){String str=s.nextLine();int a= Integer.parseInt(str.split(",")[0]);int b= Integer.parseInt(str.split(",")[1]);int t=p[a];p[a]=p[b];p[b]=t;}
		for(int i=1;i<l;i++)System.out.println(p[i]);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int l=Integer.parseInt(s.nextLine())+1;
		int x=Integer.parseInt(s.nextLine());
		int[] p = new int[l];
		for(int i=0;i<l;i++)p[i]=i;
		while(x-->0){String str=s.nextLine();int a= Integer.parseInt(str.split(",")[0]);int b= Integer.parseInt(str.split(",")[1]);int t=p[a];p[a]=p[b];p[b]=t;}
		for(int i=1;i<l;i++)System.out.println(p[i]);
	}
} Main
import java.io.*;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int l=Integer.parseInt(s.nextLine())+1;
		int x=Integer.parseInt(s.nextLine());
		int[] p = new int[l];
		for(int i=0;i<l;i++)p[i]=i;
		while(x-->0){String str=s.nextLine();int a= Integer.parseInt(str.split(",")[0]);int b= Integer.parseInt(str.split(",")[1]);int t=p[a];p[a]=p[b];p[b]=t;}
		for(int i=1;i<l;i++)System.out.println(p[i]);
	}
}