import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] num;
		String str;
		
		int tmp;
		int W = Integer.parseInt(br.readLine());
		int N = Integer.parseInt(br.readLine());
		int[] array = new int[W];

		NumAB[] pair = new NumAB[N];
		for(int i=0;i<W;i++){
			array[i]=i;
		}

		for(int i=0;i<N;i++){
			str = br.readLine();
			num = str.split(",",0);
			pair[i] = new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1);
		}
		for(int i=0;i<N;i++){
			tmp = array[pair[i].a];
			array[pair[i].a] = array[pair[i].b];
			array[pair[i].b] = tmp;
		}
		for(int i=0;i<W;i++){
			array[i]=array[i]+1;
			System.out.println(array[i]);
		}
	}
}

final class NumAB{
	int a,b;

	//?????????????????????
	NumAB(int x, int y){
		a=x;
		b=y;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] num;
		String str;
		
		int tmp;
		int W = Integer.parseInt(br.readLine());
		int N = Integer.parseInt(br.readLine());
		int[] array = new int[W];

		NumAB[] pair = new NumAB[N];
		for(int i=0;i<W;i++){
			array[i]=i;
		}

		for(int i=0;i<N;i++){
			str = br.readLine();
			num = str.split(",",0);
			pair[i] = new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1);
		}
		for(int i=0;i<N;i++){
			tmp = array[pair[i].a];
			array[pair[i].a] = array[pair[i].b];
			array[pair[i].b] = tmp;
		}
		for(int i=0;i<W;i++){
			array[i]=array[i]+1;
			System.out.println(array[i]);
		}
	}
} Main public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] num;
		String str;
		
		int tmp;
		int W = Integer.parseInt(br.readLine());
		int N = Integer.parseInt(br.readLine());
		int[] array = new int[W];

		NumAB[] pair = new NumAB[N];
		for(int i=0;i<W;i++){
			array[i]=i;
		}

		for(int i=0;i<N;i++){
			str = br.readLine();
			num = str.split(",",0);
			pair[i] = new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1);
		}
		for(int i=0;i<N;i++){
			tmp = array[pair[i].a];
			array[pair[i].a] = array[pair[i].b];
			array[pair[i].b] = tmp;
		}
		for(int i=0;i<W;i++){
			array[i]=array[i]+1;
			System.out.println(array[i]);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] num;
		String str;
		
		int tmp;
		int W = Integer.parseInt(br.readLine());
		int N = Integer.parseInt(br.readLine());
		int[] array = new int[W];

		NumAB[] pair = new NumAB[N];
		for(int i=0;i<W;i++){
			array[i]=i;
		}

		for(int i=0;i<N;i++){
			str = br.readLine();
			num = str.split(",",0);
			pair[i] = new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1);
		}
		for(int i=0;i<N;i++){
			tmp = array[pair[i].a];
			array[pair[i].a] = array[pair[i].b];
			array[pair[i].b] = tmp;
		}
		for(int i=0;i<W;i++){
			array[i]=array[i]+1;
			System.out.println(array[i]);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] num; num String str; str int tmp; tmp int W = Integer.parseInt(br.readLine()); W Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int N = Integer.parseInt(br.readLine()); N Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] array = new int[W]; array new int[W] W NumAB[] pair = new NumAB[N]; pair new NumAB[N] N for(int i=0;i<W;i++){
			array[i]=i;
		} int i=0; int i=0; i 0 i<W i W i++ i++ i {
			array[i]=i;
		} {
			array[i]=i;
		} array[i]=i array[i] array i i for(int i=0;i<N;i++){
			str = br.readLine();
			num = str.split(",",0);
			pair[i] = new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1);
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			str = br.readLine();
			num = str.split(",",0);
			pair[i] = new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1);
		} {
			str = br.readLine();
			num = str.split(",",0);
			pair[i] = new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1);
		} str = br.readLine() str br.readLine() br.readLine br num = str.split(",",0) num str.split(",",0) str.split str "," 0 pair[i] = new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1) pair[i] pair i new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1) for(int i=0;i<N;i++){
			tmp = array[pair[i].a];
			array[pair[i].a] = array[pair[i].b];
			array[pair[i].b] = tmp;
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			tmp = array[pair[i].a];
			array[pair[i].a] = array[pair[i].b];
			array[pair[i].b] = tmp;
		} {
			tmp = array[pair[i].a];
			array[pair[i].a] = array[pair[i].b];
			array[pair[i].b] = tmp;
		} tmp = array[pair[i].a] tmp array[pair[i].a] array pair[i].a pair[i] pair i pair[i].a array[pair[i].a] = array[pair[i].b] array[pair[i].a] array pair[i].a pair[i] pair i pair[i].a array[pair[i].b] array pair[i].b pair[i] pair i pair[i].b array[pair[i].b] = tmp array[pair[i].b] array pair[i].b pair[i] pair i pair[i].b tmp for(int i=0;i<W;i++){
			array[i]=array[i]+1;
			System.out.println(array[i]);
		} int i=0; int i=0; i 0 i<W i W i++ i++ i {
			array[i]=array[i]+1;
			System.out.println(array[i]);
		} {
			array[i]=array[i]+1;
			System.out.println(array[i]);
		} array[i]=array[i]+1 array[i] array i array[i]+1 array[i] array i 1 System.out.println(array[i]) System.out.println System.out System System.out array[i] array i String[] args args final class NumAB{
	int a,b;

	//?????????????????????
	NumAB(int x, int y){
		a=x;
		b=y;
	}
} NumAB int a a b; b //?????????????????????
	NumAB(int x, int y){
		a=x;
		b=y;
	} NumAB {
		a=x;
		b=y;
	} a=x a x b=y b y int x x int y y public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] num;
		String str;
		
		int tmp;
		int W = Integer.parseInt(br.readLine());
		int N = Integer.parseInt(br.readLine());
		int[] array = new int[W];

		NumAB[] pair = new NumAB[N];
		for(int i=0;i<W;i++){
			array[i]=i;
		}

		for(int i=0;i<N;i++){
			str = br.readLine();
			num = str.split(",",0);
			pair[i] = new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1);
		}
		for(int i=0;i<N;i++){
			tmp = array[pair[i].a];
			array[pair[i].a] = array[pair[i].b];
			array[pair[i].b] = tmp;
		}
		for(int i=0;i<W;i++){
			array[i]=array[i]+1;
			System.out.println(array[i]);
		}
	}
} public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] num;
		String str;
		
		int tmp;
		int W = Integer.parseInt(br.readLine());
		int N = Integer.parseInt(br.readLine());
		int[] array = new int[W];

		NumAB[] pair = new NumAB[N];
		for(int i=0;i<W;i++){
			array[i]=i;
		}

		for(int i=0;i<N;i++){
			str = br.readLine();
			num = str.split(",",0);
			pair[i] = new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1);
		}
		for(int i=0;i<N;i++){
			tmp = array[pair[i].a];
			array[pair[i].a] = array[pair[i].b];
			array[pair[i].b] = tmp;
		}
		for(int i=0;i<W;i++){
			array[i]=array[i]+1;
			System.out.println(array[i]);
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] num;
		String str;
		
		int tmp;
		int W = Integer.parseInt(br.readLine());
		int N = Integer.parseInt(br.readLine());
		int[] array = new int[W];

		NumAB[] pair = new NumAB[N];
		for(int i=0;i<W;i++){
			array[i]=i;
		}

		for(int i=0;i<N;i++){
			str = br.readLine();
			num = str.split(",",0);
			pair[i] = new NumAB(Integer.parseInt(num[0])-1,Integer.parseInt(num[1])-1);
		}
		for(int i=0;i<N;i++){
			tmp = array[pair[i].a];
			array[pair[i].a] = array[pair[i].b];
			array[pair[i].b] = tmp;
		}
		for(int i=0;i<W;i++){
			array[i]=array[i]+1;
			System.out.println(array[i]);
		}
	}
}

final class NumAB{
	int a,b;

	//?????????????????????
	NumAB(int x, int y){
		a=x;
		b=y;
	}
}