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

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		//scan.useDelimiter(",|?\n");
		int w=scan.nextInt();
		int n=scan.nextInt();
		String input;
		int a,b;
		int[] ans=new int[w];
		for(int i=0;i<w;i++){
			ans[i]=i+1;
		}
		//scan.useDelimiter(",|?\n");-----How!?!?!?
		for(int i=0;i<n;i++){
			input = scan.next();
			a=Integer.parseInt(input.substring(0,input.indexOf(",")));
			//System.out.println(a);
			b=Integer.parseInt(input.substring(input.indexOf(",")+1,input.length()));
			//System.out.println(b);
			a-=1;
			b-=1;
			int temp=ans[a];
			ans[a]=ans[b];
			ans[b]=temp;
		}
		for(int i=0;i<w;i++){
			System.out.println(ans[i]);
		}
	}
} import java.io.*; io.* java import java.util.*; util.* java public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		//scan.useDelimiter(",|?\n");
		int w=scan.nextInt();
		int n=scan.nextInt();
		String input;
		int a,b;
		int[] ans=new int[w];
		for(int i=0;i<w;i++){
			ans[i]=i+1;
		}
		//scan.useDelimiter(",|?\n");-----How!?!?!?
		for(int i=0;i<n;i++){
			input = scan.next();
			a=Integer.parseInt(input.substring(0,input.indexOf(",")));
			//System.out.println(a);
			b=Integer.parseInt(input.substring(input.indexOf(",")+1,input.length()));
			//System.out.println(b);
			a-=1;
			b-=1;
			int temp=ans[a];
			ans[a]=ans[b];
			ans[b]=temp;
		}
		for(int i=0;i<w;i++){
			System.out.println(ans[i]);
		}
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		//scan.useDelimiter(",|?\n");
		int w=scan.nextInt();
		int n=scan.nextInt();
		String input;
		int a,b;
		int[] ans=new int[w];
		for(int i=0;i<w;i++){
			ans[i]=i+1;
		}
		//scan.useDelimiter(",|?\n");-----How!?!?!?
		for(int i=0;i<n;i++){
			input = scan.next();
			a=Integer.parseInt(input.substring(0,input.indexOf(",")));
			//System.out.println(a);
			b=Integer.parseInt(input.substring(input.indexOf(",")+1,input.length()));
			//System.out.println(b);
			a-=1;
			b-=1;
			int temp=ans[a];
			ans[a]=ans[b];
			ans[b]=temp;
		}
		for(int i=0;i<w;i++){
			System.out.println(ans[i]);
		}
	} main {
		Scanner scan = new Scanner(System.in);
		//scan.useDelimiter(",|?\n");
		int w=scan.nextInt();
		int n=scan.nextInt();
		String input;
		int a,b;
		int[] ans=new int[w];
		for(int i=0;i<w;i++){
			ans[i]=i+1;
		}
		//scan.useDelimiter(",|?\n");-----How!?!?!?
		for(int i=0;i<n;i++){
			input = scan.next();
			a=Integer.parseInt(input.substring(0,input.indexOf(",")));
			//System.out.println(a);
			b=Integer.parseInt(input.substring(input.indexOf(",")+1,input.length()));
			//System.out.println(b);
			a-=1;
			b-=1;
			int temp=ans[a];
			ans[a]=ans[b];
			ans[b]=temp;
		}
		for(int i=0;i<w;i++){
			System.out.println(ans[i]);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w=scan.nextInt(); w scan.nextInt() scan.nextInt scan int n=scan.nextInt(); n scan.nextInt() scan.nextInt scan String input; input int a a b; b int[] ans=new int[w]; ans new int[w] w for(int i=0;i<w;i++){
			ans[i]=i+1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			ans[i]=i+1;
		} {
			ans[i]=i+1;
		} ans[i]=i+1 ans[i] ans i i+1 i 1 for(int i=0;i<n;i++){
			input = scan.next();
			a=Integer.parseInt(input.substring(0,input.indexOf(",")));
			//System.out.println(a);
			b=Integer.parseInt(input.substring(input.indexOf(",")+1,input.length()));
			//System.out.println(b);
			a-=1;
			b-=1;
			int temp=ans[a];
			ans[a]=ans[b];
			ans[b]=temp;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			input = scan.next();
			a=Integer.parseInt(input.substring(0,input.indexOf(",")));
			//System.out.println(a);
			b=Integer.parseInt(input.substring(input.indexOf(",")+1,input.length()));
			//System.out.println(b);
			a-=1;
			b-=1;
			int temp=ans[a];
			ans[a]=ans[b];
			ans[b]=temp;
		} {
			input = scan.next();
			a=Integer.parseInt(input.substring(0,input.indexOf(",")));
			//System.out.println(a);
			b=Integer.parseInt(input.substring(input.indexOf(",")+1,input.length()));
			//System.out.println(b);
			a-=1;
			b-=1;
			int temp=ans[a];
			ans[a]=ans[b];
			ans[b]=temp;
		} input = scan.next() input scan.next() scan.next scan a=Integer.parseInt(input.substring(0,input.indexOf(","))) a Integer.parseInt(input.substring(0,input.indexOf(","))) Integer.parseInt Integer input.substring(0,input.indexOf(",")) input.substring input 0 input.indexOf(",") input.indexOf input "," b=Integer.parseInt(input.substring(input.indexOf(",")+1,input.length())) b Integer.parseInt(input.substring(input.indexOf(",")+1,input.length())) Integer.parseInt Integer input.substring(input.indexOf(",")+1,input.length()) input.substring input input.indexOf(",")+1 input.indexOf(",") input.indexOf input "," 1 input.length() input.length input a-=1 a 1 b-=1 b 1 int temp=ans[a]; temp ans[a] ans a ans[a]=ans[b] ans[a] ans a ans[b] ans b ans[b]=temp ans[b] ans b temp 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(ans[i]) System.out.println System.out System System.out ans[i] ans i String[] args args public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		//scan.useDelimiter(",|?\n");
		int w=scan.nextInt();
		int n=scan.nextInt();
		String input;
		int a,b;
		int[] ans=new int[w];
		for(int i=0;i<w;i++){
			ans[i]=i+1;
		}
		//scan.useDelimiter(",|?\n");-----How!?!?!?
		for(int i=0;i<n;i++){
			input = scan.next();
			a=Integer.parseInt(input.substring(0,input.indexOf(",")));
			//System.out.println(a);
			b=Integer.parseInt(input.substring(input.indexOf(",")+1,input.length()));
			//System.out.println(b);
			a-=1;
			b-=1;
			int temp=ans[a];
			ans[a]=ans[b];
			ans[b]=temp;
		}
		for(int i=0;i<w;i++){
			System.out.println(ans[i]);
		}
	}
} public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		//scan.useDelimiter(",|?\n");
		int w=scan.nextInt();
		int n=scan.nextInt();
		String input;
		int a,b;
		int[] ans=new int[w];
		for(int i=0;i<w;i++){
			ans[i]=i+1;
		}
		//scan.useDelimiter(",|?\n");-----How!?!?!?
		for(int i=0;i<n;i++){
			input = scan.next();
			a=Integer.parseInt(input.substring(0,input.indexOf(",")));
			//System.out.println(a);
			b=Integer.parseInt(input.substring(input.indexOf(",")+1,input.length()));
			//System.out.println(b);
			a-=1;
			b-=1;
			int temp=ans[a];
			ans[a]=ans[b];
			ans[b]=temp;
		}
		for(int i=0;i<w;i++){
			System.out.println(ans[i]);
		}
	}
} Main
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		//scan.useDelimiter(",|?\n");
		int w=scan.nextInt();
		int n=scan.nextInt();
		String input;
		int a,b;
		int[] ans=new int[w];
		for(int i=0;i<w;i++){
			ans[i]=i+1;
		}
		//scan.useDelimiter(",|?\n");-----How!?!?!?
		for(int i=0;i<n;i++){
			input = scan.next();
			a=Integer.parseInt(input.substring(0,input.indexOf(",")));
			//System.out.println(a);
			b=Integer.parseInt(input.substring(input.indexOf(",")+1,input.length()));
			//System.out.println(b);
			a-=1;
			b-=1;
			int temp=ans[a];
			ans[a]=ans[b];
			ans[b]=temp;
		}
		for(int i=0;i<w;i++){
			System.out.println(ans[i]);
		}
	}
}