import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] a = new int[w];
		String[] st = new String[2];
		for(int i = 0; i < a.length; i++)
			a[i] = i + 1;
		
		for(int i = 0; i < n; i++){
			String str = sc.next();
			st = str.split(",",0);
			int x = Integer.parseInt(st[0])-1;
			int y = Integer.parseInt(st[1])-1;
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		for(int i = 0; i < a.length; i++){
			System.out.println(a[i]);
		}
	}
} import java.util.*; util.* java class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] a = new int[w];
		String[] st = new String[2];
		for(int i = 0; i < a.length; i++)
			a[i] = i + 1;
		
		for(int i = 0; i < n; i++){
			String str = sc.next();
			st = str.split(",",0);
			int x = Integer.parseInt(st[0])-1;
			int y = Integer.parseInt(st[1])-1;
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		for(int i = 0; i < a.length; i++){
			System.out.println(a[i]);
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] a = new int[w];
		String[] st = new String[2];
		for(int i = 0; i < a.length; i++)
			a[i] = i + 1;
		
		for(int i = 0; i < n; i++){
			String str = sc.next();
			st = str.split(",",0);
			int x = Integer.parseInt(st[0])-1;
			int y = Integer.parseInt(st[1])-1;
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		for(int i = 0; i < a.length; i++){
			System.out.println(a[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] a = new int[w];
		String[] st = new String[2];
		for(int i = 0; i < a.length; i++)
			a[i] = i + 1;
		
		for(int i = 0; i < n; i++){
			String str = sc.next();
			st = str.split(",",0);
			int x = Integer.parseInt(st[0])-1;
			int y = Integer.parseInt(st[1])-1;
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		for(int i = 0; i < a.length; i++){
			System.out.println(a[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[w]; a new int[w] w String[] st = new String[2]; st new String[2] 2 for(int i = 0; i < a.length; i++)
			a[i] = i + 1; int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i a[i] = i + 1; a[i] = i + 1 a[i] a i i + 1 i 1 for(int i = 0; i < n; i++){
			String str = sc.next();
			st = str.split(",",0);
			int x = Integer.parseInt(st[0])-1;
			int y = Integer.parseInt(st[1])-1;
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String str = sc.next();
			st = str.split(",",0);
			int x = Integer.parseInt(st[0])-1;
			int y = Integer.parseInt(st[1])-1;
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		} {
			String str = sc.next();
			st = str.split(",",0);
			int x = Integer.parseInt(st[0])-1;
			int y = Integer.parseInt(st[1])-1;
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		} String str = sc.next(); str sc.next() sc.next sc st = str.split(",",0) st str.split(",",0) str.split str "," 0 int x = Integer.parseInt(st[0])-1; x Integer.parseInt(st[0])-1 Integer.parseInt(st[0]) Integer.parseInt Integer st[0] st 0 1 int y = Integer.parseInt(st[1])-1; y Integer.parseInt(st[1])-1 Integer.parseInt(st[1]) Integer.parseInt Integer st[1] st 1 1 int t = a[x]; t a[x] a x a[x] = a[y] a[x] a x a[y] a y a[y] = t a[y] a y t for(int i = 0; i < a.length; i++){
			System.out.println(a[i]);
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			System.out.println(a[i]);
		} {
			System.out.println(a[i]);
		} System.out.println(a[i]) System.out.println System.out System System.out a[i] a i String[] args args
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] a = new int[w];
		String[] st = new String[2];
		for(int i = 0; i < a.length; i++)
			a[i] = i + 1;
		
		for(int i = 0; i < n; i++){
			String str = sc.next();
			st = str.split(",",0);
			int x = Integer.parseInt(st[0])-1;
			int y = Integer.parseInt(st[1])-1;
			int t = a[x];
			a[x] = a[y];
			a[y] = t;
		}
		for(int i = 0; i < a.length; i++){
			System.out.println(a[i]);
		}
	}
}