import java.util.Scanner;
import java.lang.Math;

public class Main {

	public static void main(String args[]){

		int w,n,a,b,temp;
		Scanner in = new Scanner(System.in);
		
		w = Integer.parseInt(in.next());
		n = Integer.parseInt(in.next());
		
		int lot[] = new int[w];
		
		for(int i=0;i<w;i++){
			lot[i] = i+1;
		}
		
		String[] array;
		
		for(int i=0;i<n;i++){
			array = in.next().split(",");
			a = Integer.parseInt(array[0]) -1;
			b = Integer.parseInt(array[1]) -1;
			
			temp = lot[a];
			lot[a] = lot[b];
			lot[b] = temp;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(lot[i]);
		}
		in.close();
	}
} import java.util.Scanner; Scanner java.util import java.lang.Math; Math java.lang public class Main {

	public static void main(String args[]){

		int w,n,a,b,temp;
		Scanner in = new Scanner(System.in);
		
		w = Integer.parseInt(in.next());
		n = Integer.parseInt(in.next());
		
		int lot[] = new int[w];
		
		for(int i=0;i<w;i++){
			lot[i] = i+1;
		}
		
		String[] array;
		
		for(int i=0;i<n;i++){
			array = in.next().split(",");
			a = Integer.parseInt(array[0]) -1;
			b = Integer.parseInt(array[1]) -1;
			
			temp = lot[a];
			lot[a] = lot[b];
			lot[b] = temp;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(lot[i]);
		}
		in.close();
	}
} Main public static void main(String args[]){

		int w,n,a,b,temp;
		Scanner in = new Scanner(System.in);
		
		w = Integer.parseInt(in.next());
		n = Integer.parseInt(in.next());
		
		int lot[] = new int[w];
		
		for(int i=0;i<w;i++){
			lot[i] = i+1;
		}
		
		String[] array;
		
		for(int i=0;i<n;i++){
			array = in.next().split(",");
			a = Integer.parseInt(array[0]) -1;
			b = Integer.parseInt(array[1]) -1;
			
			temp = lot[a];
			lot[a] = lot[b];
			lot[b] = temp;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(lot[i]);
		}
		in.close();
	} main {

		int w,n,a,b,temp;
		Scanner in = new Scanner(System.in);
		
		w = Integer.parseInt(in.next());
		n = Integer.parseInt(in.next());
		
		int lot[] = new int[w];
		
		for(int i=0;i<w;i++){
			lot[i] = i+1;
		}
		
		String[] array;
		
		for(int i=0;i<n;i++){
			array = in.next().split(",");
			a = Integer.parseInt(array[0]) -1;
			b = Integer.parseInt(array[1]) -1;
			
			temp = lot[a];
			lot[a] = lot[b];
			lot[b] = temp;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(lot[i]);
		}
		in.close();
	} int w w n n a a b b temp; temp Scanner in = new Scanner(System.in); in new Scanner(System.in) w = Integer.parseInt(in.next()) w Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in n = Integer.parseInt(in.next()) n Integer.parseInt(in.next()) Integer.parseInt Integer in.next() in.next in int lot[] = new int[w]; lot new int[w] w for(int i=0;i<w;i++){
			lot[i] = i+1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			lot[i] = i+1;
		} {
			lot[i] = i+1;
		} lot[i] = i+1 lot[i] lot i i+1 i 1 String[] array; array for(int i=0;i<n;i++){
			array = in.next().split(",");
			a = Integer.parseInt(array[0]) -1;
			b = Integer.parseInt(array[1]) -1;
			
			temp = lot[a];
			lot[a] = lot[b];
			lot[b] = temp;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			array = in.next().split(",");
			a = Integer.parseInt(array[0]) -1;
			b = Integer.parseInt(array[1]) -1;
			
			temp = lot[a];
			lot[a] = lot[b];
			lot[b] = temp;
		} {
			array = in.next().split(",");
			a = Integer.parseInt(array[0]) -1;
			b = Integer.parseInt(array[1]) -1;
			
			temp = lot[a];
			lot[a] = lot[b];
			lot[b] = temp;
		} array = in.next().split(",") array in.next().split(",") in.next().split in.next() in.next in "," a = Integer.parseInt(array[0]) -1 a Integer.parseInt(array[0]) -1 Integer.parseInt(array[0]) Integer.parseInt Integer array[0] array 0 1 b = Integer.parseInt(array[1]) -1 b Integer.parseInt(array[1]) -1 Integer.parseInt(array[1]) Integer.parseInt Integer array[1] array 1 1 temp = lot[a] temp lot[a] lot a lot[a] = lot[b] lot[a] lot a lot[b] lot b lot[b] = temp lot[b] lot b temp for(int i=0;i<w;i++){
			System.out.println(lot[i]);
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			System.out.println(lot[i]);
		} {
			System.out.println(lot[i]);
		} System.out.println(lot[i]) System.out.println System.out System System.out lot[i] lot i in.close() in.close in String args[] args public class Main {

	public static void main(String args[]){

		int w,n,a,b,temp;
		Scanner in = new Scanner(System.in);
		
		w = Integer.parseInt(in.next());
		n = Integer.parseInt(in.next());
		
		int lot[] = new int[w];
		
		for(int i=0;i<w;i++){
			lot[i] = i+1;
		}
		
		String[] array;
		
		for(int i=0;i<n;i++){
			array = in.next().split(",");
			a = Integer.parseInt(array[0]) -1;
			b = Integer.parseInt(array[1]) -1;
			
			temp = lot[a];
			lot[a] = lot[b];
			lot[b] = temp;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(lot[i]);
		}
		in.close();
	}
} public class Main {

	public static void main(String args[]){

		int w,n,a,b,temp;
		Scanner in = new Scanner(System.in);
		
		w = Integer.parseInt(in.next());
		n = Integer.parseInt(in.next());
		
		int lot[] = new int[w];
		
		for(int i=0;i<w;i++){
			lot[i] = i+1;
		}
		
		String[] array;
		
		for(int i=0;i<n;i++){
			array = in.next().split(",");
			a = Integer.parseInt(array[0]) -1;
			b = Integer.parseInt(array[1]) -1;
			
			temp = lot[a];
			lot[a] = lot[b];
			lot[b] = temp;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(lot[i]);
		}
		in.close();
	}
} Main
import java.util.Scanner;
import java.lang.Math;

public class Main {

	public static void main(String args[]){

		int w,n,a,b,temp;
		Scanner in = new Scanner(System.in);
		
		w = Integer.parseInt(in.next());
		n = Integer.parseInt(in.next());
		
		int lot[] = new int[w];
		
		for(int i=0;i<w;i++){
			lot[i] = i+1;
		}
		
		String[] array;
		
		for(int i=0;i<n;i++){
			array = in.next().split(",");
			a = Integer.parseInt(array[0]) -1;
			b = Integer.parseInt(array[1]) -1;
			
			temp = lot[a];
			lot[a] = lot[b];
			lot[b] = temp;
		}
		
		for(int i=0;i<w;i++){
			System.out.println(lot[i]);
		}
		in.close();
	}
}