import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);

		int num = Integer.parseInt(sc.nextLine());
		int[] e = new int[num];
		for (int i = 0; i < num; i++) {
			e[i] = i + 1;
		}
		
		int lim = Integer.parseInt(sc.nextLine());
		for (int i = 0; i < lim; i++) {
			String[] params = sc.nextLine().split(",");
			int l = Integer.parseInt(params[0]) - 1;
			int r = Integer.parseInt(params[1]) - 1;
			
			int tmp = e[l];
			e[l] = e[r];
			e[r] = tmp;
		}
		
		for (int i = 0; i < num; i++) {
			System.out.println(e[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);

		int num = Integer.parseInt(sc.nextLine());
		int[] e = new int[num];
		for (int i = 0; i < num; i++) {
			e[i] = i + 1;
		}
		
		int lim = Integer.parseInt(sc.nextLine());
		for (int i = 0; i < lim; i++) {
			String[] params = sc.nextLine().split(",");
			int l = Integer.parseInt(params[0]) - 1;
			int r = Integer.parseInt(params[1]) - 1;
			
			int tmp = e[l];
			e[l] = e[r];
			e[r] = tmp;
		}
		
		for (int i = 0; i < num; i++) {
			System.out.println(e[i]);
		}
	}
} Main private Scanner sc; sc public static void main(String[] args) {
		new Main();
	} main {
		new Main();
	} new Main() String[] args args public Main() {
		sc = new Scanner(System.in);

		int num = Integer.parseInt(sc.nextLine());
		int[] e = new int[num];
		for (int i = 0; i < num; i++) {
			e[i] = i + 1;
		}
		
		int lim = Integer.parseInt(sc.nextLine());
		for (int i = 0; i < lim; i++) {
			String[] params = sc.nextLine().split(",");
			int l = Integer.parseInt(params[0]) - 1;
			int r = Integer.parseInt(params[1]) - 1;
			
			int tmp = e[l];
			e[l] = e[r];
			e[r] = tmp;
		}
		
		for (int i = 0; i < num; i++) {
			System.out.println(e[i]);
		}
	} Main {
		sc = new Scanner(System.in);

		int num = Integer.parseInt(sc.nextLine());
		int[] e = new int[num];
		for (int i = 0; i < num; i++) {
			e[i] = i + 1;
		}
		
		int lim = Integer.parseInt(sc.nextLine());
		for (int i = 0; i < lim; i++) {
			String[] params = sc.nextLine().split(",");
			int l = Integer.parseInt(params[0]) - 1;
			int r = Integer.parseInt(params[1]) - 1;
			
			int tmp = e[l];
			e[l] = e[r];
			e[r] = tmp;
		}
		
		for (int i = 0; i < num; i++) {
			System.out.println(e[i]);
		}
	} sc = new Scanner(System.in) sc new Scanner(System.in) int num = Integer.parseInt(sc.nextLine()); num Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int[] e = new int[num]; e new int[num] num for (int i = 0; i < num; i++) {
			e[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
			e[i] = i + 1;
		} {
			e[i] = i + 1;
		} e[i] = i + 1 e[i] e i i + 1 i 1 int lim = Integer.parseInt(sc.nextLine()); lim Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc for (int i = 0; i < lim; i++) {
			String[] params = sc.nextLine().split(",");
			int l = Integer.parseInt(params[0]) - 1;
			int r = Integer.parseInt(params[1]) - 1;
			
			int tmp = e[l];
			e[l] = e[r];
			e[r] = tmp;
		} int i = 0; int i = 0; i 0 i < lim i lim i++ i++ i {
			String[] params = sc.nextLine().split(",");
			int l = Integer.parseInt(params[0]) - 1;
			int r = Integer.parseInt(params[1]) - 1;
			
			int tmp = e[l];
			e[l] = e[r];
			e[r] = tmp;
		} {
			String[] params = sc.nextLine().split(",");
			int l = Integer.parseInt(params[0]) - 1;
			int r = Integer.parseInt(params[1]) - 1;
			
			int tmp = e[l];
			e[l] = e[r];
			e[r] = tmp;
		} String[] params = sc.nextLine().split(","); params sc.nextLine().split(",") sc.nextLine().split sc.nextLine() sc.nextLine sc "," int l = Integer.parseInt(params[0]) - 1; l Integer.parseInt(params[0]) - 1 Integer.parseInt(params[0]) Integer.parseInt Integer params[0] params 0 1 int r = Integer.parseInt(params[1]) - 1; r Integer.parseInt(params[1]) - 1 Integer.parseInt(params[1]) Integer.parseInt Integer params[1] params 1 1 int tmp = e[l]; tmp e[l] e l e[l] = e[r] e[l] e l e[r] e r e[r] = tmp e[r] e r tmp for (int i = 0; i < num; i++) {
			System.out.println(e[i]);
		} int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
			System.out.println(e[i]);
		} {
			System.out.println(e[i]);
		} System.out.println(e[i]) System.out.println System.out System System.out e[i] e i public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);

		int num = Integer.parseInt(sc.nextLine());
		int[] e = new int[num];
		for (int i = 0; i < num; i++) {
			e[i] = i + 1;
		}
		
		int lim = Integer.parseInt(sc.nextLine());
		for (int i = 0; i < lim; i++) {
			String[] params = sc.nextLine().split(",");
			int l = Integer.parseInt(params[0]) - 1;
			int r = Integer.parseInt(params[1]) - 1;
			
			int tmp = e[l];
			e[l] = e[r];
			e[r] = tmp;
		}
		
		for (int i = 0; i < num; i++) {
			System.out.println(e[i]);
		}
	}
} public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);

		int num = Integer.parseInt(sc.nextLine());
		int[] e = new int[num];
		for (int i = 0; i < num; i++) {
			e[i] = i + 1;
		}
		
		int lim = Integer.parseInt(sc.nextLine());
		for (int i = 0; i < lim; i++) {
			String[] params = sc.nextLine().split(",");
			int l = Integer.parseInt(params[0]) - 1;
			int r = Integer.parseInt(params[1]) - 1;
			
			int tmp = e[l];
			e[l] = e[r];
			e[r] = tmp;
		}
		
		for (int i = 0; i < num; i++) {
			System.out.println(e[i]);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);

		int num = Integer.parseInt(sc.nextLine());
		int[] e = new int[num];
		for (int i = 0; i < num; i++) {
			e[i] = i + 1;
		}
		
		int lim = Integer.parseInt(sc.nextLine());
		for (int i = 0; i < lim; i++) {
			String[] params = sc.nextLine().split(",");
			int l = Integer.parseInt(params[0]) - 1;
			int r = Integer.parseInt(params[1]) - 1;
			
			int tmp = e[l];
			e[l] = e[r];
			e[r] = tmp;
		}
		
		for (int i = 0; i < num; i++) {
			System.out.println(e[i]);
		}
	}
}