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 str = br.readLine();
		int verticalLines = Integer.parseInt(str);
		int[] num = new int[verticalLines];
		for (int i = 0; i < verticalLines; i++) {
			num[i] = i + 1;
		}
		str = br.readLine();
		int horizontalLines = Integer.parseInt(str);
		for (int j = 0; j < horizontalLines; j++) {
			str = br.readLine();
			String[] edge = str.split(",", 2);
			int startingPoint = Integer.parseInt(edge[0]);
			int destination = Integer.parseInt(edge[1]);
			int temporary = num[destination - 1];
			num[destination - 1] = num[startingPoint - 1];
			num[startingPoint - 1] = temporary;
		}
		for (int number : num) {
			System.out.println(number);
		}
	}
} 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 str = br.readLine();
		int verticalLines = Integer.parseInt(str);
		int[] num = new int[verticalLines];
		for (int i = 0; i < verticalLines; i++) {
			num[i] = i + 1;
		}
		str = br.readLine();
		int horizontalLines = Integer.parseInt(str);
		for (int j = 0; j < horizontalLines; j++) {
			str = br.readLine();
			String[] edge = str.split(",", 2);
			int startingPoint = Integer.parseInt(edge[0]);
			int destination = Integer.parseInt(edge[1]);
			int temporary = num[destination - 1];
			num[destination - 1] = num[startingPoint - 1];
			num[startingPoint - 1] = temporary;
		}
		for (int number : num) {
			System.out.println(number);
		}
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int verticalLines = Integer.parseInt(str);
		int[] num = new int[verticalLines];
		for (int i = 0; i < verticalLines; i++) {
			num[i] = i + 1;
		}
		str = br.readLine();
		int horizontalLines = Integer.parseInt(str);
		for (int j = 0; j < horizontalLines; j++) {
			str = br.readLine();
			String[] edge = str.split(",", 2);
			int startingPoint = Integer.parseInt(edge[0]);
			int destination = Integer.parseInt(edge[1]);
			int temporary = num[destination - 1];
			num[destination - 1] = num[startingPoint - 1];
			num[startingPoint - 1] = temporary;
		}
		for (int number : num) {
			System.out.println(number);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int verticalLines = Integer.parseInt(str);
		int[] num = new int[verticalLines];
		for (int i = 0; i < verticalLines; i++) {
			num[i] = i + 1;
		}
		str = br.readLine();
		int horizontalLines = Integer.parseInt(str);
		for (int j = 0; j < horizontalLines; j++) {
			str = br.readLine();
			String[] edge = str.split(",", 2);
			int startingPoint = Integer.parseInt(edge[0]);
			int destination = Integer.parseInt(edge[1]);
			int temporary = num[destination - 1];
			num[destination - 1] = num[startingPoint - 1];
			num[startingPoint - 1] = temporary;
		}
		for (int number : num) {
			System.out.println(number);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str = br.readLine(); str br.readLine() br.readLine br int verticalLines = Integer.parseInt(str); verticalLines Integer.parseInt(str) Integer.parseInt Integer str int[] num = new int[verticalLines]; num new int[verticalLines] verticalLines for (int i = 0; i < verticalLines; i++) {
			num[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < verticalLines i verticalLines i++ i++ i {
			num[i] = i + 1;
		} {
			num[i] = i + 1;
		} num[i] = i + 1 num[i] num i i + 1 i 1 str = br.readLine() str br.readLine() br.readLine br int horizontalLines = Integer.parseInt(str); horizontalLines Integer.parseInt(str) Integer.parseInt Integer str for (int j = 0; j < horizontalLines; j++) {
			str = br.readLine();
			String[] edge = str.split(",", 2);
			int startingPoint = Integer.parseInt(edge[0]);
			int destination = Integer.parseInt(edge[1]);
			int temporary = num[destination - 1];
			num[destination - 1] = num[startingPoint - 1];
			num[startingPoint - 1] = temporary;
		} int j = 0; int j = 0; j 0 j < horizontalLines j horizontalLines j++ j++ j {
			str = br.readLine();
			String[] edge = str.split(",", 2);
			int startingPoint = Integer.parseInt(edge[0]);
			int destination = Integer.parseInt(edge[1]);
			int temporary = num[destination - 1];
			num[destination - 1] = num[startingPoint - 1];
			num[startingPoint - 1] = temporary;
		} {
			str = br.readLine();
			String[] edge = str.split(",", 2);
			int startingPoint = Integer.parseInt(edge[0]);
			int destination = Integer.parseInt(edge[1]);
			int temporary = num[destination - 1];
			num[destination - 1] = num[startingPoint - 1];
			num[startingPoint - 1] = temporary;
		} str = br.readLine() str br.readLine() br.readLine br String[] edge = str.split(",", 2); edge str.split(",", 2) str.split str "," 2 int startingPoint = Integer.parseInt(edge[0]); startingPoint Integer.parseInt(edge[0]) Integer.parseInt Integer edge[0] edge 0 int destination = Integer.parseInt(edge[1]); destination Integer.parseInt(edge[1]) Integer.parseInt Integer edge[1] edge 1 int temporary = num[destination - 1]; temporary num[destination - 1] num destination - 1 destination 1 num[destination - 1] = num[startingPoint - 1] num[destination - 1] num destination - 1 destination 1 num[startingPoint - 1] num startingPoint - 1 startingPoint 1 num[startingPoint - 1] = temporary num[startingPoint - 1] num startingPoint - 1 startingPoint 1 temporary for (int number : num) {
			System.out.println(number);
		} int number num {
			System.out.println(number);
		} {
			System.out.println(number);
		} System.out.println(number) System.out.println System.out System System.out number String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int verticalLines = Integer.parseInt(str);
		int[] num = new int[verticalLines];
		for (int i = 0; i < verticalLines; i++) {
			num[i] = i + 1;
		}
		str = br.readLine();
		int horizontalLines = Integer.parseInt(str);
		for (int j = 0; j < horizontalLines; j++) {
			str = br.readLine();
			String[] edge = str.split(",", 2);
			int startingPoint = Integer.parseInt(edge[0]);
			int destination = Integer.parseInt(edge[1]);
			int temporary = num[destination - 1];
			num[destination - 1] = num[startingPoint - 1];
			num[startingPoint - 1] = temporary;
		}
		for (int number : num) {
			System.out.println(number);
		}
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int verticalLines = Integer.parseInt(str);
		int[] num = new int[verticalLines];
		for (int i = 0; i < verticalLines; i++) {
			num[i] = i + 1;
		}
		str = br.readLine();
		int horizontalLines = Integer.parseInt(str);
		for (int j = 0; j < horizontalLines; j++) {
			str = br.readLine();
			String[] edge = str.split(",", 2);
			int startingPoint = Integer.parseInt(edge[0]);
			int destination = Integer.parseInt(edge[1]);
			int temporary = num[destination - 1];
			num[destination - 1] = num[startingPoint - 1];
			num[startingPoint - 1] = temporary;
		}
		for (int number : num) {
			System.out.println(number);
		}
	}
} 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 str = br.readLine();
		int verticalLines = Integer.parseInt(str);
		int[] num = new int[verticalLines];
		for (int i = 0; i < verticalLines; i++) {
			num[i] = i + 1;
		}
		str = br.readLine();
		int horizontalLines = Integer.parseInt(str);
		for (int j = 0; j < horizontalLines; j++) {
			str = br.readLine();
			String[] edge = str.split(",", 2);
			int startingPoint = Integer.parseInt(edge[0]);
			int destination = Integer.parseInt(edge[1]);
			int temporary = num[destination - 1];
			num[destination - 1] = num[startingPoint - 1];
			num[startingPoint - 1] = temporary;
		}
		for (int number : num) {
			System.out.println(number);
		}
	}
}