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

public class Main {

	public static void main(String[] args) throws IOException {
		//Input Initialize
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int Nver = Integer.parseInt(str);
		int[] Ver = new int[Nver];
		for (int i = 0; i < Nver; i++) {
			Ver[i] = i + 1;
		}

		str =br.readLine();
		int Nhor = Integer.parseInt(str);

		for (int i = 0; i < Nhor; i++) {
			//Input swap
			str = br.readLine();
			String[] tmp = str.split(",", 0);
			int[] SW = new int[2];
			SW[0] = Integer.parseInt(tmp[0]);
			SW[1] = Integer.parseInt(tmp[1]);

			//Swap
			swap(Ver, SW[0], SW[1]);

		}

		for (int i = 0; i < Nver; i++) {
			System.out.println(Ver[i]);
		}
	}

	private  static void swap(int[] N, int a, int b) {
		int tmp;
		tmp = N[a-1]; N[a-1] = N[b-1]; N[b-1] = tmp;
		return;
	}

} 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 {
		//Input Initialize
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int Nver = Integer.parseInt(str);
		int[] Ver = new int[Nver];
		for (int i = 0; i < Nver; i++) {
			Ver[i] = i + 1;
		}

		str =br.readLine();
		int Nhor = Integer.parseInt(str);

		for (int i = 0; i < Nhor; i++) {
			//Input swap
			str = br.readLine();
			String[] tmp = str.split(",", 0);
			int[] SW = new int[2];
			SW[0] = Integer.parseInt(tmp[0]);
			SW[1] = Integer.parseInt(tmp[1]);

			//Swap
			swap(Ver, SW[0], SW[1]);

		}

		for (int i = 0; i < Nver; i++) {
			System.out.println(Ver[i]);
		}
	}

	private  static void swap(int[] N, int a, int b) {
		int tmp;
		tmp = N[a-1]; N[a-1] = N[b-1]; N[b-1] = tmp;
		return;
	}

} Main public static void main(String[] args) throws IOException {
		//Input Initialize
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int Nver = Integer.parseInt(str);
		int[] Ver = new int[Nver];
		for (int i = 0; i < Nver; i++) {
			Ver[i] = i + 1;
		}

		str =br.readLine();
		int Nhor = Integer.parseInt(str);

		for (int i = 0; i < Nhor; i++) {
			//Input swap
			str = br.readLine();
			String[] tmp = str.split(",", 0);
			int[] SW = new int[2];
			SW[0] = Integer.parseInt(tmp[0]);
			SW[1] = Integer.parseInt(tmp[1]);

			//Swap
			swap(Ver, SW[0], SW[1]);

		}

		for (int i = 0; i < Nver; i++) {
			System.out.println(Ver[i]);
		}
	} main {
		//Input Initialize
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int Nver = Integer.parseInt(str);
		int[] Ver = new int[Nver];
		for (int i = 0; i < Nver; i++) {
			Ver[i] = i + 1;
		}

		str =br.readLine();
		int Nhor = Integer.parseInt(str);

		for (int i = 0; i < Nhor; i++) {
			//Input swap
			str = br.readLine();
			String[] tmp = str.split(",", 0);
			int[] SW = new int[2];
			SW[0] = Integer.parseInt(tmp[0]);
			SW[1] = Integer.parseInt(tmp[1]);

			//Swap
			swap(Ver, SW[0], SW[1]);

		}

		for (int i = 0; i < Nver; i++) {
			System.out.println(Ver[i]);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str; str str = br.readLine() str br.readLine() br.readLine br int Nver = Integer.parseInt(str); Nver Integer.parseInt(str) Integer.parseInt Integer str int[] Ver = new int[Nver]; Ver new int[Nver] Nver for (int i = 0; i < Nver; i++) {
			Ver[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < Nver i Nver i++ i++ i {
			Ver[i] = i + 1;
		} {
			Ver[i] = i + 1;
		} Ver[i] = i + 1 Ver[i] Ver i i + 1 i 1 str =br.readLine() str br.readLine() br.readLine br int Nhor = Integer.parseInt(str); Nhor Integer.parseInt(str) Integer.parseInt Integer str for (int i = 0; i < Nhor; i++) {
			//Input swap
			str = br.readLine();
			String[] tmp = str.split(",", 0);
			int[] SW = new int[2];
			SW[0] = Integer.parseInt(tmp[0]);
			SW[1] = Integer.parseInt(tmp[1]);

			//Swap
			swap(Ver, SW[0], SW[1]);

		} int i = 0; int i = 0; i 0 i < Nhor i Nhor i++ i++ i {
			//Input swap
			str = br.readLine();
			String[] tmp = str.split(",", 0);
			int[] SW = new int[2];
			SW[0] = Integer.parseInt(tmp[0]);
			SW[1] = Integer.parseInt(tmp[1]);

			//Swap
			swap(Ver, SW[0], SW[1]);

		} {
			//Input swap
			str = br.readLine();
			String[] tmp = str.split(",", 0);
			int[] SW = new int[2];
			SW[0] = Integer.parseInt(tmp[0]);
			SW[1] = Integer.parseInt(tmp[1]);

			//Swap
			swap(Ver, SW[0], SW[1]);

		} str = br.readLine() str br.readLine() br.readLine br String[] tmp = str.split(",", 0); tmp str.split(",", 0) str.split str "," 0 int[] SW = new int[2]; SW new int[2] 2 SW[0] = Integer.parseInt(tmp[0]) SW[0] SW 0 Integer.parseInt(tmp[0]) Integer.parseInt Integer tmp[0] tmp 0 SW[1] = Integer.parseInt(tmp[1]) SW[1] SW 1 Integer.parseInt(tmp[1]) Integer.parseInt Integer tmp[1] tmp 1 swap(Ver, SW[0], SW[1]) swap Ver SW[0] SW 0 SW[1] SW 1 for (int i = 0; i < Nver; i++) {
			System.out.println(Ver[i]);
		} int i = 0; int i = 0; i 0 i < Nver i Nver i++ i++ i {
			System.out.println(Ver[i]);
		} {
			System.out.println(Ver[i]);
		} System.out.println(Ver[i]) System.out.println System.out System System.out Ver[i] Ver i String[] args args private  static void swap(int[] N, int a, int b) {
		int tmp;
		tmp = N[a-1]; N[a-1] = N[b-1]; N[b-1] = tmp;
		return;
	} swap {
		int tmp;
		tmp = N[a-1]; N[a-1] = N[b-1]; N[b-1] = tmp;
		return;
	} int tmp; tmp tmp = N[a-1] tmp N[a-1] N a-1 a 1 N[a-1] = N[b-1] N[a-1] N a-1 a 1 N[b-1] N b-1 b 1 N[b-1] = tmp N[b-1] N b-1 b 1 tmp return; int[] N N int a a int b b public class Main {

	public static void main(String[] args) throws IOException {
		//Input Initialize
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int Nver = Integer.parseInt(str);
		int[] Ver = new int[Nver];
		for (int i = 0; i < Nver; i++) {
			Ver[i] = i + 1;
		}

		str =br.readLine();
		int Nhor = Integer.parseInt(str);

		for (int i = 0; i < Nhor; i++) {
			//Input swap
			str = br.readLine();
			String[] tmp = str.split(",", 0);
			int[] SW = new int[2];
			SW[0] = Integer.parseInt(tmp[0]);
			SW[1] = Integer.parseInt(tmp[1]);

			//Swap
			swap(Ver, SW[0], SW[1]);

		}

		for (int i = 0; i < Nver; i++) {
			System.out.println(Ver[i]);
		}
	}

	private  static void swap(int[] N, int a, int b) {
		int tmp;
		tmp = N[a-1]; N[a-1] = N[b-1]; N[b-1] = tmp;
		return;
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		//Input Initialize
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int Nver = Integer.parseInt(str);
		int[] Ver = new int[Nver];
		for (int i = 0; i < Nver; i++) {
			Ver[i] = i + 1;
		}

		str =br.readLine();
		int Nhor = Integer.parseInt(str);

		for (int i = 0; i < Nhor; i++) {
			//Input swap
			str = br.readLine();
			String[] tmp = str.split(",", 0);
			int[] SW = new int[2];
			SW[0] = Integer.parseInt(tmp[0]);
			SW[1] = Integer.parseInt(tmp[1]);

			//Swap
			swap(Ver, SW[0], SW[1]);

		}

		for (int i = 0; i < Nver; i++) {
			System.out.println(Ver[i]);
		}
	}

	private  static void swap(int[] N, int a, int b) {
		int tmp;
		tmp = N[a-1]; N[a-1] = N[b-1]; N[b-1] = tmp;
		return;
	}

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

public class Main {

	public static void main(String[] args) throws IOException {
		//Input Initialize
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		str = br.readLine();
		int Nver = Integer.parseInt(str);
		int[] Ver = new int[Nver];
		for (int i = 0; i < Nver; i++) {
			Ver[i] = i + 1;
		}

		str =br.readLine();
		int Nhor = Integer.parseInt(str);

		for (int i = 0; i < Nhor; i++) {
			//Input swap
			str = br.readLine();
			String[] tmp = str.split(",", 0);
			int[] SW = new int[2];
			SW[0] = Integer.parseInt(tmp[0]);
			SW[1] = Integer.parseInt(tmp[1]);

			//Swap
			swap(Ver, SW[0], SW[1]);

		}

		for (int i = 0; i < Nver; i++) {
			System.out.println(Ver[i]);
		}
	}

	private  static void swap(int[] N, int a, int b) {
		int tmp;
		tmp = N[a-1]; N[a-1] = N[b-1]; N[b-1] = tmp;
		return;
	}

}