

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

public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		
		int[] arr = new int[w + 1];
		for (int i = 1; i <= w ; i++) {
			arr[i] = i;
		}
		
		String line;
		while ((line = br.readLine()) != null) {
			String[] ab = line.split(",");
			int a1 = Integer.parseInt(ab[0]);
			int b1 = Integer.parseInt(ab[1]);
			int temp = arr[a1];
			arr[a1] = arr[b1];
			arr[b1] = temp;
		}

		for (int i = 1; i <= w ; i++) {
			System.out.println(arr[i]);
		}
	}

} 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 NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		
		int[] arr = new int[w + 1];
		for (int i = 1; i <= w ; i++) {
			arr[i] = i;
		}
		
		String line;
		while ((line = br.readLine()) != null) {
			String[] ab = line.split(",");
			int a1 = Integer.parseInt(ab[0]);
			int b1 = Integer.parseInt(ab[1]);
			int temp = arr[a1];
			arr[a1] = arr[b1];
			arr[b1] = temp;
		}

		for (int i = 1; i <= w ; i++) {
			System.out.println(arr[i]);
		}
	}

} Main public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		
		int[] arr = new int[w + 1];
		for (int i = 1; i <= w ; i++) {
			arr[i] = i;
		}
		
		String line;
		while ((line = br.readLine()) != null) {
			String[] ab = line.split(",");
			int a1 = Integer.parseInt(ab[0]);
			int b1 = Integer.parseInt(ab[1]);
			int temp = arr[a1];
			arr[a1] = arr[b1];
			arr[b1] = temp;
		}

		for (int i = 1; i <= w ; i++) {
			System.out.println(arr[i]);
		}
	} main {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		
		int[] arr = new int[w + 1];
		for (int i = 1; i <= w ; i++) {
			arr[i] = i;
		}
		
		String line;
		while ((line = br.readLine()) != null) {
			String[] ab = line.split(",");
			int a1 = Integer.parseInt(ab[0]);
			int b1 = Integer.parseInt(ab[1]);
			int temp = arr[a1];
			arr[a1] = arr[b1];
			arr[b1] = temp;
		}

		for (int i = 1; i <= w ; i++) {
			System.out.println(arr[i]);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) 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[] arr = new int[w + 1]; arr new int[w + 1] w + 1 w 1 for (int i = 1; i <= w ; i++) {
			arr[i] = i;
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			arr[i] = i;
		} {
			arr[i] = i;
		} arr[i] = i arr[i] arr i i String line; line while ((line = br.readLine()) != null) {
			String[] ab = line.split(",");
			int a1 = Integer.parseInt(ab[0]);
			int b1 = Integer.parseInt(ab[1]);
			int temp = arr[a1];
			arr[a1] = arr[b1];
			arr[b1] = temp;
		} (line = br.readLine()) != null (line = br.readLine()) line br.readLine() br.readLine br null {
			String[] ab = line.split(",");
			int a1 = Integer.parseInt(ab[0]);
			int b1 = Integer.parseInt(ab[1]);
			int temp = arr[a1];
			arr[a1] = arr[b1];
			arr[b1] = temp;
		} String[] ab = line.split(","); ab line.split(",") line.split line "," int a1 = Integer.parseInt(ab[0]); a1 Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 int b1 = Integer.parseInt(ab[1]); b1 Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 int temp = arr[a1]; temp arr[a1] arr a1 arr[a1] = arr[b1] arr[a1] arr a1 arr[b1] arr b1 arr[b1] = temp arr[b1] arr b1 temp for (int i = 1; i <= w ; i++) {
			System.out.println(arr[i]);
		} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
			System.out.println(arr[i]);
		} {
			System.out.println(arr[i]);
		} System.out.println(arr[i]) System.out.println System.out System System.out arr[i] arr i String[] args args public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		
		int[] arr = new int[w + 1];
		for (int i = 1; i <= w ; i++) {
			arr[i] = i;
		}
		
		String line;
		while ((line = br.readLine()) != null) {
			String[] ab = line.split(",");
			int a1 = Integer.parseInt(ab[0]);
			int b1 = Integer.parseInt(ab[1]);
			int temp = arr[a1];
			arr[a1] = arr[b1];
			arr[b1] = temp;
		}

		for (int i = 1; i <= w ; i++) {
			System.out.println(arr[i]);
		}
	}

} public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		
		int[] arr = new int[w + 1];
		for (int i = 1; i <= w ; i++) {
			arr[i] = i;
		}
		
		String line;
		while ((line = br.readLine()) != null) {
			String[] ab = line.split(",");
			int a1 = Integer.parseInt(ab[0]);
			int b1 = Integer.parseInt(ab[1]);
			int temp = arr[a1];
			arr[a1] = arr[b1];
			arr[b1] = temp;
		}

		for (int i = 1; i <= w ; i++) {
			System.out.println(arr[i]);
		}
	}

} Main


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

public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		
		int[] arr = new int[w + 1];
		for (int i = 1; i <= w ; i++) {
			arr[i] = i;
		}
		
		String line;
		while ((line = br.readLine()) != null) {
			String[] ab = line.split(",");
			int a1 = Integer.parseInt(ab[0]);
			int b1 = Integer.parseInt(ab[1]);
			int temp = arr[a1];
			arr[a1] = arr[b1];
			arr[b1] = temp;
		}

		for (int i = 1; i <= w ; i++) {
			System.out.println(arr[i]);
		}
	}

}