import java.util.*;

public class Main{
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int[] mem;
		int n,time,i;
		
		n = sc.nextInt();
		time = sc.nextInt();
		mem = new int[n];
		
		for (i=0 ; i<n ; i++) {
			mem[i] = i+1;
		}
		
		for (i=0 ; i<time ; i++) {
			String reader;
			String[] swap;
			swap = new String[2];
			reader = sc.next();
			swap = reader.split(",");
			
			int a = Integer.parseInt(swap[0])-1;
			int b = Integer.parseInt(swap[1])-1;
			
			int m = mem[a];
			mem[a] = mem[b];
			mem[b] = m;
		}
		
		for (i=0 ; i<n ; i++) {
			System.out.println(""+mem[i]);
		}
		
		sc.close();
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int[] mem;
		int n,time,i;
		
		n = sc.nextInt();
		time = sc.nextInt();
		mem = new int[n];
		
		for (i=0 ; i<n ; i++) {
			mem[i] = i+1;
		}
		
		for (i=0 ; i<time ; i++) {
			String reader;
			String[] swap;
			swap = new String[2];
			reader = sc.next();
			swap = reader.split(",");
			
			int a = Integer.parseInt(swap[0])-1;
			int b = Integer.parseInt(swap[1])-1;
			
			int m = mem[a];
			mem[a] = mem[b];
			mem[b] = m;
		}
		
		for (i=0 ; i<n ; i++) {
			System.out.println(""+mem[i]);
		}
		
		sc.close();
	}
} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int[] mem;
		int n,time,i;
		
		n = sc.nextInt();
		time = sc.nextInt();
		mem = new int[n];
		
		for (i=0 ; i<n ; i++) {
			mem[i] = i+1;
		}
		
		for (i=0 ; i<time ; i++) {
			String reader;
			String[] swap;
			swap = new String[2];
			reader = sc.next();
			swap = reader.split(",");
			
			int a = Integer.parseInt(swap[0])-1;
			int b = Integer.parseInt(swap[1])-1;
			
			int m = mem[a];
			mem[a] = mem[b];
			mem[b] = m;
		}
		
		for (i=0 ; i<n ; i++) {
			System.out.println(""+mem[i]);
		}
		
		sc.close();
	} main {
		
		Scanner sc = new Scanner(System.in);
		int[] mem;
		int n,time,i;
		
		n = sc.nextInt();
		time = sc.nextInt();
		mem = new int[n];
		
		for (i=0 ; i<n ; i++) {
			mem[i] = i+1;
		}
		
		for (i=0 ; i<time ; i++) {
			String reader;
			String[] swap;
			swap = new String[2];
			reader = sc.next();
			swap = reader.split(",");
			
			int a = Integer.parseInt(swap[0])-1;
			int b = Integer.parseInt(swap[1])-1;
			
			int m = mem[a];
			mem[a] = mem[b];
			mem[b] = m;
		}
		
		for (i=0 ; i<n ; i++) {
			System.out.println(""+mem[i]);
		}
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] mem; mem int n n time time i; i n = sc.nextInt() n sc.nextInt() sc.nextInt sc time = sc.nextInt() time sc.nextInt() sc.nextInt sc mem = new int[n] mem new int[n] n for (i=0 ; i<n ; i++) {
			mem[i] = i+1;
		} i=0 ; i=0 i 0 i<n i n i++ i++ i {
			mem[i] = i+1;
		} {
			mem[i] = i+1;
		} mem[i] = i+1 mem[i] mem i i+1 i 1 for (i=0 ; i<time ; i++) {
			String reader;
			String[] swap;
			swap = new String[2];
			reader = sc.next();
			swap = reader.split(",");
			
			int a = Integer.parseInt(swap[0])-1;
			int b = Integer.parseInt(swap[1])-1;
			
			int m = mem[a];
			mem[a] = mem[b];
			mem[b] = m;
		} i=0 ; i=0 i 0 i<time i time i++ i++ i {
			String reader;
			String[] swap;
			swap = new String[2];
			reader = sc.next();
			swap = reader.split(",");
			
			int a = Integer.parseInt(swap[0])-1;
			int b = Integer.parseInt(swap[1])-1;
			
			int m = mem[a];
			mem[a] = mem[b];
			mem[b] = m;
		} {
			String reader;
			String[] swap;
			swap = new String[2];
			reader = sc.next();
			swap = reader.split(",");
			
			int a = Integer.parseInt(swap[0])-1;
			int b = Integer.parseInt(swap[1])-1;
			
			int m = mem[a];
			mem[a] = mem[b];
			mem[b] = m;
		} String reader; reader String[] swap; swap swap = new String[2] swap new String[2] 2 reader = sc.next() reader sc.next() sc.next sc swap = reader.split(",") swap reader.split(",") reader.split reader "," int a = Integer.parseInt(swap[0])-1; a Integer.parseInt(swap[0])-1 Integer.parseInt(swap[0]) Integer.parseInt Integer swap[0] swap 0 1 int b = Integer.parseInt(swap[1])-1; b Integer.parseInt(swap[1])-1 Integer.parseInt(swap[1]) Integer.parseInt Integer swap[1] swap 1 1 int m = mem[a]; m mem[a] mem a mem[a] = mem[b] mem[a] mem a mem[b] mem b mem[b] = m mem[b] mem b m for (i=0 ; i<n ; i++) {
			System.out.println(""+mem[i]);
		} i=0 ; i=0 i 0 i<n i n i++ i++ i {
			System.out.println(""+mem[i]);
		} {
			System.out.println(""+mem[i]);
		} System.out.println(""+mem[i]) System.out.println System.out System System.out ""+mem[i] "" mem[i] mem i sc.close() sc.close sc String[] args args public class Main{
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int[] mem;
		int n,time,i;
		
		n = sc.nextInt();
		time = sc.nextInt();
		mem = new int[n];
		
		for (i=0 ; i<n ; i++) {
			mem[i] = i+1;
		}
		
		for (i=0 ; i<time ; i++) {
			String reader;
			String[] swap;
			swap = new String[2];
			reader = sc.next();
			swap = reader.split(",");
			
			int a = Integer.parseInt(swap[0])-1;
			int b = Integer.parseInt(swap[1])-1;
			
			int m = mem[a];
			mem[a] = mem[b];
			mem[b] = m;
		}
		
		for (i=0 ; i<n ; i++) {
			System.out.println(""+mem[i]);
		}
		
		sc.close();
	}
} public class Main{
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int[] mem;
		int n,time,i;
		
		n = sc.nextInt();
		time = sc.nextInt();
		mem = new int[n];
		
		for (i=0 ; i<n ; i++) {
			mem[i] = i+1;
		}
		
		for (i=0 ; i<time ; i++) {
			String reader;
			String[] swap;
			swap = new String[2];
			reader = sc.next();
			swap = reader.split(",");
			
			int a = Integer.parseInt(swap[0])-1;
			int b = Integer.parseInt(swap[1])-1;
			
			int m = mem[a];
			mem[a] = mem[b];
			mem[b] = m;
		}
		
		for (i=0 ; i<n ; i++) {
			System.out.println(""+mem[i]);
		}
		
		sc.close();
	}
} Main
import java.util.*;

public class Main{
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int[] mem;
		int n,time,i;
		
		n = sc.nextInt();
		time = sc.nextInt();
		mem = new int[n];
		
		for (i=0 ; i<n ; i++) {
			mem[i] = i+1;
		}
		
		for (i=0 ; i<time ; i++) {
			String reader;
			String[] swap;
			swap = new String[2];
			reader = sc.next();
			swap = reader.split(",");
			
			int a = Integer.parseInt(swap[0])-1;
			int b = Integer.parseInt(swap[1])-1;
			
			int m = mem[a];
			mem[a] = mem[b];
			mem[b] = m;
		}
		
		for (i=0 ; i<n ; i++) {
			System.out.println(""+mem[i]);
		}
		
		sc.close();
	}
}
