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

//public class Problem0011_DrawingLots {
public class Main {
	public static void main(String[] args) {
		try {
		//	Problem0011_DrawingLots test = new Problem0011_DrawingLots();
			Main test = new Main();
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line = reader.readLine();
			
			int volume = Integer.parseInt(line);
			int swappingCount = Integer.parseInt(reader.readLine());
			int[][] swaps = new int[swappingCount][2];
			
			for(int i = 0; i < swappingCount; i++) {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			}
			test.showAnswer(volume, swaps);
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	void showAnswer(int number, int[][] arrays) {
		int[] numbers = new int[number];
		for(int i = 0; i < numbers.length; i++) {
			numbers[i] = i+1;
		}
		
		for(int[] array : arrays) {
			swap(numbers, array[0]-1, array[1]-1);
		}
		for(int positionNumber : numbers) {
			System.out.println(positionNumber);
		}
	}
	void swap(int[] target, int position1, int position2) {
		int temporary = target[position1];
		target[position1] = target[position2];
		target[position2] = temporary;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) {
		try {
		//	Problem0011_DrawingLots test = new Problem0011_DrawingLots();
			Main test = new Main();
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line = reader.readLine();
			
			int volume = Integer.parseInt(line);
			int swappingCount = Integer.parseInt(reader.readLine());
			int[][] swaps = new int[swappingCount][2];
			
			for(int i = 0; i < swappingCount; i++) {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			}
			test.showAnswer(volume, swaps);
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	void showAnswer(int number, int[][] arrays) {
		int[] numbers = new int[number];
		for(int i = 0; i < numbers.length; i++) {
			numbers[i] = i+1;
		}
		
		for(int[] array : arrays) {
			swap(numbers, array[0]-1, array[1]-1);
		}
		for(int positionNumber : numbers) {
			System.out.println(positionNumber);
		}
	}
	void swap(int[] target, int position1, int position2) {
		int temporary = target[position1];
		target[position1] = target[position2];
		target[position2] = temporary;
	}
} Main public static void main(String[] args) {
		try {
		//	Problem0011_DrawingLots test = new Problem0011_DrawingLots();
			Main test = new Main();
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line = reader.readLine();
			
			int volume = Integer.parseInt(line);
			int swappingCount = Integer.parseInt(reader.readLine());
			int[][] swaps = new int[swappingCount][2];
			
			for(int i = 0; i < swappingCount; i++) {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			}
			test.showAnswer(volume, swaps);
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	} main {
		try {
		//	Problem0011_DrawingLots test = new Problem0011_DrawingLots();
			Main test = new Main();
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line = reader.readLine();
			
			int volume = Integer.parseInt(line);
			int swappingCount = Integer.parseInt(reader.readLine());
			int[][] swaps = new int[swappingCount][2];
			
			for(int i = 0; i < swappingCount; i++) {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			}
			test.showAnswer(volume, swaps);
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	} try {
		//	Problem0011_DrawingLots test = new Problem0011_DrawingLots();
			Main test = new Main();
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line = reader.readLine();
			
			int volume = Integer.parseInt(line);
			int swappingCount = Integer.parseInt(reader.readLine());
			int[][] swaps = new int[swappingCount][2];
			
			for(int i = 0; i < swappingCount; i++) {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			}
			test.showAnswer(volume, swaps);
			
		} catch(Exception e) {
			e.printStackTrace();
		} catch(Exception e) {
			e.printStackTrace();
		} Exception e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
		//	Problem0011_DrawingLots test = new Problem0011_DrawingLots();
			Main test = new Main();
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line = reader.readLine();
			
			int volume = Integer.parseInt(line);
			int swappingCount = Integer.parseInt(reader.readLine());
			int[][] swaps = new int[swappingCount][2];
			
			for(int i = 0; i < swappingCount; i++) {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			}
			test.showAnswer(volume, swaps);
			
		} Main test = new Main(); test new Main() BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String line = reader.readLine(); line reader.readLine() reader.readLine reader int volume = Integer.parseInt(line); volume Integer.parseInt(line) Integer.parseInt Integer line int swappingCount = Integer.parseInt(reader.readLine()); swappingCount Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int[][] swaps = new int[swappingCount][2]; swaps new int[swappingCount][2] swappingCount 2 for(int i = 0; i < swappingCount; i++) {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			} int i = 0; int i = 0; i 0 i < swappingCount i swappingCount i++ i++ i {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			} {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			} line = reader.readLine() line reader.readLine() reader.readLine reader String[] textArray = line.split(","); textArray line.split(",") line.split line "," for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				} int j = 0; int j = 0; j 0 j < 2 j 2 j++ j++ j {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				} {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				} swaps[i][j] = Integer.parseInt(textArray[j]) swaps[i][j] swaps[i] swaps i j Integer.parseInt(textArray[j]) Integer.parseInt Integer textArray[j] textArray j test.showAnswer(volume, swaps) test.showAnswer test volume swaps String[] args args void showAnswer(int number, int[][] arrays) {
		int[] numbers = new int[number];
		for(int i = 0; i < numbers.length; i++) {
			numbers[i] = i+1;
		}
		
		for(int[] array : arrays) {
			swap(numbers, array[0]-1, array[1]-1);
		}
		for(int positionNumber : numbers) {
			System.out.println(positionNumber);
		}
	} showAnswer {
		int[] numbers = new int[number];
		for(int i = 0; i < numbers.length; i++) {
			numbers[i] = i+1;
		}
		
		for(int[] array : arrays) {
			swap(numbers, array[0]-1, array[1]-1);
		}
		for(int positionNumber : numbers) {
			System.out.println(positionNumber);
		}
	} int[] numbers = new int[number]; numbers new int[number] number for(int i = 0; i < numbers.length; i++) {
			numbers[i] = i+1;
		} int i = 0; int i = 0; i 0 i < numbers.length i numbers.length numbers numbers.length i++ i++ i {
			numbers[i] = i+1;
		} {
			numbers[i] = i+1;
		} numbers[i] = i+1 numbers[i] numbers i i+1 i 1 for(int[] array : arrays) {
			swap(numbers, array[0]-1, array[1]-1);
		} int[] array arrays {
			swap(numbers, array[0]-1, array[1]-1);
		} {
			swap(numbers, array[0]-1, array[1]-1);
		} swap(numbers, array[0]-1, array[1]-1) swap numbers array[0]-1 array[0] array 0 1 array[1]-1 array[1] array 1 1 for(int positionNumber : numbers) {
			System.out.println(positionNumber);
		} int positionNumber numbers {
			System.out.println(positionNumber);
		} {
			System.out.println(positionNumber);
		} System.out.println(positionNumber) System.out.println System.out System System.out positionNumber int number number int[][] arrays arrays void swap(int[] target, int position1, int position2) {
		int temporary = target[position1];
		target[position1] = target[position2];
		target[position2] = temporary;
	} swap {
		int temporary = target[position1];
		target[position1] = target[position2];
		target[position2] = temporary;
	} int temporary = target[position1]; temporary target[position1] target position1 target[position1] = target[position2] target[position1] target position1 target[position2] target position2 target[position2] = temporary target[position2] target position2 temporary int[] target target int position1 position1 int position2 position2 public class Main {
	public static void main(String[] args) {
		try {
		//	Problem0011_DrawingLots test = new Problem0011_DrawingLots();
			Main test = new Main();
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line = reader.readLine();
			
			int volume = Integer.parseInt(line);
			int swappingCount = Integer.parseInt(reader.readLine());
			int[][] swaps = new int[swappingCount][2];
			
			for(int i = 0; i < swappingCount; i++) {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			}
			test.showAnswer(volume, swaps);
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	void showAnswer(int number, int[][] arrays) {
		int[] numbers = new int[number];
		for(int i = 0; i < numbers.length; i++) {
			numbers[i] = i+1;
		}
		
		for(int[] array : arrays) {
			swap(numbers, array[0]-1, array[1]-1);
		}
		for(int positionNumber : numbers) {
			System.out.println(positionNumber);
		}
	}
	void swap(int[] target, int position1, int position2) {
		int temporary = target[position1];
		target[position1] = target[position2];
		target[position2] = temporary;
	}
} public class Main {
	public static void main(String[] args) {
		try {
		//	Problem0011_DrawingLots test = new Problem0011_DrawingLots();
			Main test = new Main();
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line = reader.readLine();
			
			int volume = Integer.parseInt(line);
			int swappingCount = Integer.parseInt(reader.readLine());
			int[][] swaps = new int[swappingCount][2];
			
			for(int i = 0; i < swappingCount; i++) {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			}
			test.showAnswer(volume, swaps);
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	void showAnswer(int number, int[][] arrays) {
		int[] numbers = new int[number];
		for(int i = 0; i < numbers.length; i++) {
			numbers[i] = i+1;
		}
		
		for(int[] array : arrays) {
			swap(numbers, array[0]-1, array[1]-1);
		}
		for(int positionNumber : numbers) {
			System.out.println(positionNumber);
		}
	}
	void swap(int[] target, int position1, int position2) {
		int temporary = target[position1];
		target[position1] = target[position2];
		target[position2] = temporary;
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

//public class Problem0011_DrawingLots {
public class Main {
	public static void main(String[] args) {
		try {
		//	Problem0011_DrawingLots test = new Problem0011_DrawingLots();
			Main test = new Main();
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line = reader.readLine();
			
			int volume = Integer.parseInt(line);
			int swappingCount = Integer.parseInt(reader.readLine());
			int[][] swaps = new int[swappingCount][2];
			
			for(int i = 0; i < swappingCount; i++) {
				line = reader.readLine();
				String[] textArray = line.split(",");
				for(int j = 0; j < 2; j++) {
					swaps[i][j] = Integer.parseInt(textArray[j]);
				}
			}
			test.showAnswer(volume, swaps);
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	void showAnswer(int number, int[][] arrays) {
		int[] numbers = new int[number];
		for(int i = 0; i < numbers.length; i++) {
			numbers[i] = i+1;
		}
		
		for(int[] array : arrays) {
			swap(numbers, array[0]-1, array[1]-1);
		}
		for(int positionNumber : numbers) {
			System.out.println(positionNumber);
		}
	}
	void swap(int[] target, int position1, int position2) {
		int temporary = target[position1];
		target[position1] = target[position2];
		target[position2] = temporary;
	}
}