import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		int N = Integer.parseInt(input.nextLine());
		int W = Integer.parseInt(input.nextLine());
		
		int[] v = new int[N];
		
		for(int i = 0; i < N; i++) v[i] = i;
		
		for(int i = 0; i < W; i++) {
			String[] s = input.nextLine().split("[,]");
			int a = Integer.parseInt(s[0]) - 1;
			int b = Integer.parseInt(s[1]) - 1;
			
			int tmp = v[a];
			v[a] = v[b];
			v[b] = tmp;			
		}
		for(int i = 0; i < N; i++) {
			System.out.println(v[i] + 1);			
		}
		System.exit(0);
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		int N = Integer.parseInt(input.nextLine());
		int W = Integer.parseInt(input.nextLine());
		
		int[] v = new int[N];
		
		for(int i = 0; i < N; i++) v[i] = i;
		
		for(int i = 0; i < W; i++) {
			String[] s = input.nextLine().split("[,]");
			int a = Integer.parseInt(s[0]) - 1;
			int b = Integer.parseInt(s[1]) - 1;
			
			int tmp = v[a];
			v[a] = v[b];
			v[b] = tmp;			
		}
		for(int i = 0; i < N; i++) {
			System.out.println(v[i] + 1);			
		}
		System.exit(0);
	}
} Main public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		int N = Integer.parseInt(input.nextLine());
		int W = Integer.parseInt(input.nextLine());
		
		int[] v = new int[N];
		
		for(int i = 0; i < N; i++) v[i] = i;
		
		for(int i = 0; i < W; i++) {
			String[] s = input.nextLine().split("[,]");
			int a = Integer.parseInt(s[0]) - 1;
			int b = Integer.parseInt(s[1]) - 1;
			
			int tmp = v[a];
			v[a] = v[b];
			v[b] = tmp;			
		}
		for(int i = 0; i < N; i++) {
			System.out.println(v[i] + 1);			
		}
		System.exit(0);
	} main {
		Scanner input = new Scanner(System.in);
		
		int N = Integer.parseInt(input.nextLine());
		int W = Integer.parseInt(input.nextLine());
		
		int[] v = new int[N];
		
		for(int i = 0; i < N; i++) v[i] = i;
		
		for(int i = 0; i < W; i++) {
			String[] s = input.nextLine().split("[,]");
			int a = Integer.parseInt(s[0]) - 1;
			int b = Integer.parseInt(s[1]) - 1;
			
			int tmp = v[a];
			v[a] = v[b];
			v[b] = tmp;			
		}
		for(int i = 0; i < N; i++) {
			System.out.println(v[i] + 1);			
		}
		System.exit(0);
	} Scanner input = new Scanner(System.in); input new Scanner(System.in) int N = Integer.parseInt(input.nextLine()); N Integer.parseInt(input.nextLine()) Integer.parseInt Integer input.nextLine() input.nextLine input int W = Integer.parseInt(input.nextLine()); W Integer.parseInt(input.nextLine()) Integer.parseInt Integer input.nextLine() input.nextLine input int[] v = new int[N]; v new int[N] N for(int i = 0; i < N; i++) v[i] = i; int i = 0; int i = 0; i 0 i < N i N i++ i++ i v[i] = i; v[i] = i v[i] v i i for(int i = 0; i < W; i++) {
			String[] s = input.nextLine().split("[,]");
			int a = Integer.parseInt(s[0]) - 1;
			int b = Integer.parseInt(s[1]) - 1;
			
			int tmp = v[a];
			v[a] = v[b];
			v[b] = tmp;			
		} int i = 0; int i = 0; i 0 i < W i W i++ i++ i {
			String[] s = input.nextLine().split("[,]");
			int a = Integer.parseInt(s[0]) - 1;
			int b = Integer.parseInt(s[1]) - 1;
			
			int tmp = v[a];
			v[a] = v[b];
			v[b] = tmp;			
		} {
			String[] s = input.nextLine().split("[,]");
			int a = Integer.parseInt(s[0]) - 1;
			int b = Integer.parseInt(s[1]) - 1;
			
			int tmp = v[a];
			v[a] = v[b];
			v[b] = tmp;			
		} String[] s = input.nextLine().split("[,]"); s input.nextLine().split("[,]") input.nextLine().split input.nextLine() input.nextLine input "[,]" int a = Integer.parseInt(s[0]) - 1; a Integer.parseInt(s[0]) - 1 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 1 int b = Integer.parseInt(s[1]) - 1; b Integer.parseInt(s[1]) - 1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 1 int tmp = v[a]; tmp v[a] v a v[a] = v[b] v[a] v a v[b] v b v[b] = tmp v[b] v b tmp for(int i = 0; i < N; i++) {
			System.out.println(v[i] + 1);			
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			System.out.println(v[i] + 1);			
		} {
			System.out.println(v[i] + 1);			
		} System.out.println(v[i] + 1) System.out.println System.out System System.out v[i] + 1 v[i] v i 1 System.exit(0) System.exit System 0 String[] args args public class Main{
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		int N = Integer.parseInt(input.nextLine());
		int W = Integer.parseInt(input.nextLine());
		
		int[] v = new int[N];
		
		for(int i = 0; i < N; i++) v[i] = i;
		
		for(int i = 0; i < W; i++) {
			String[] s = input.nextLine().split("[,]");
			int a = Integer.parseInt(s[0]) - 1;
			int b = Integer.parseInt(s[1]) - 1;
			
			int tmp = v[a];
			v[a] = v[b];
			v[b] = tmp;			
		}
		for(int i = 0; i < N; i++) {
			System.out.println(v[i] + 1);			
		}
		System.exit(0);
	}
} public class Main{
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		int N = Integer.parseInt(input.nextLine());
		int W = Integer.parseInt(input.nextLine());
		
		int[] v = new int[N];
		
		for(int i = 0; i < N; i++) v[i] = i;
		
		for(int i = 0; i < W; i++) {
			String[] s = input.nextLine().split("[,]");
			int a = Integer.parseInt(s[0]) - 1;
			int b = Integer.parseInt(s[1]) - 1;
			
			int tmp = v[a];
			v[a] = v[b];
			v[b] = tmp;			
		}
		for(int i = 0; i < N; i++) {
			System.out.println(v[i] + 1);			
		}
		System.exit(0);
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		int N = Integer.parseInt(input.nextLine());
		int W = Integer.parseInt(input.nextLine());
		
		int[] v = new int[N];
		
		for(int i = 0; i < N; i++) v[i] = i;
		
		for(int i = 0; i < W; i++) {
			String[] s = input.nextLine().split("[,]");
			int a = Integer.parseInt(s[0]) - 1;
			int b = Integer.parseInt(s[1]) - 1;
			
			int tmp = v[a];
			v[a] = v[b];
			v[b] = tmp;			
		}
		for(int i = 0; i < N; i++) {
			System.out.println(v[i] + 1);			
		}
		System.exit(0);
	}
}