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

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int w = Integer.parseInt(br.readLine());
			int n = Integer.parseInt(br.readLine());
			int hako[] = new int[w+1];
			int dami = 0;
			
			for(int i = 1;i <= w;i++){
				hako[i] = i;
			}
			
			for(int i = 0;i < n;i++){
				String line = br.readLine();
				int a[] = new int[2];
				String s[] = line.split(",",0);
				a[0] = Integer.parseInt(s[0]);
				a[1] = Integer.parseInt(s[1]);
				
				dami = hako[a[0]];
				hako[a[0]] = hako[a[1]];
				hako[a[1]] = dami;
			}
			
			for(int i = 1;i <= w;i++){
				System.out.println(hako[i]);
			}
	}
} 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{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int w = Integer.parseInt(br.readLine());
			int n = Integer.parseInt(br.readLine());
			int hako[] = new int[w+1];
			int dami = 0;
			
			for(int i = 1;i <= w;i++){
				hako[i] = i;
			}
			
			for(int i = 0;i < n;i++){
				String line = br.readLine();
				int a[] = new int[2];
				String s[] = line.split(",",0);
				a[0] = Integer.parseInt(s[0]);
				a[1] = Integer.parseInt(s[1]);
				
				dami = hako[a[0]];
				hako[a[0]] = hako[a[1]];
				hako[a[1]] = dami;
			}
			
			for(int i = 1;i <= w;i++){
				System.out.println(hako[i]);
			}
	}
} Main public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int w = Integer.parseInt(br.readLine());
			int n = Integer.parseInt(br.readLine());
			int hako[] = new int[w+1];
			int dami = 0;
			
			for(int i = 1;i <= w;i++){
				hako[i] = i;
			}
			
			for(int i = 0;i < n;i++){
				String line = br.readLine();
				int a[] = new int[2];
				String s[] = line.split(",",0);
				a[0] = Integer.parseInt(s[0]);
				a[1] = Integer.parseInt(s[1]);
				
				dami = hako[a[0]];
				hako[a[0]] = hako[a[1]];
				hako[a[1]] = dami;
			}
			
			for(int i = 1;i <= w;i++){
				System.out.println(hako[i]);
			}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int w = Integer.parseInt(br.readLine());
			int n = Integer.parseInt(br.readLine());
			int hako[] = new int[w+1];
			int dami = 0;
			
			for(int i = 1;i <= w;i++){
				hako[i] = i;
			}
			
			for(int i = 0;i < n;i++){
				String line = br.readLine();
				int a[] = new int[2];
				String s[] = line.split(",",0);
				a[0] = Integer.parseInt(s[0]);
				a[1] = Integer.parseInt(s[1]);
				
				dami = hako[a[0]];
				hako[a[0]] = hako[a[1]];
				hako[a[1]] = dami;
			}
			
			for(int i = 1;i <= w;i++){
				System.out.println(hako[i]);
			}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int w = Integer.parseInt(br.readLine()); w Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int hako[] = new int[w+1]; hako new int[w+1] w+1 w 1 int dami = 0; dami 0 for(int i = 1;i <= w;i++){
				hako[i] = i;
			} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
				hako[i] = i;
			} {
				hako[i] = i;
			} hako[i] = i hako[i] hako i i for(int i = 0;i < n;i++){
				String line = br.readLine();
				int a[] = new int[2];
				String s[] = line.split(",",0);
				a[0] = Integer.parseInt(s[0]);
				a[1] = Integer.parseInt(s[1]);
				
				dami = hako[a[0]];
				hako[a[0]] = hako[a[1]];
				hako[a[1]] = dami;
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				String line = br.readLine();
				int a[] = new int[2];
				String s[] = line.split(",",0);
				a[0] = Integer.parseInt(s[0]);
				a[1] = Integer.parseInt(s[1]);
				
				dami = hako[a[0]];
				hako[a[0]] = hako[a[1]];
				hako[a[1]] = dami;
			} {
				String line = br.readLine();
				int a[] = new int[2];
				String s[] = line.split(",",0);
				a[0] = Integer.parseInt(s[0]);
				a[1] = Integer.parseInt(s[1]);
				
				dami = hako[a[0]];
				hako[a[0]] = hako[a[1]];
				hako[a[1]] = dami;
			} String line = br.readLine(); line br.readLine() br.readLine br int a[] = new int[2]; a new int[2] 2 String s[] = line.split(",",0); s line.split(",",0) line.split line "," 0 a[0] = Integer.parseInt(s[0]) a[0] a 0 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 a[1] = Integer.parseInt(s[1]) a[1] a 1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 dami = hako[a[0]] dami hako[a[0]] hako a[0] a 0 hako[a[0]] = hako[a[1]] hako[a[0]] hako a[0] a 0 hako[a[1]] hako a[1] a 1 hako[a[1]] = dami hako[a[1]] hako a[1] a 1 dami for(int i = 1;i <= w;i++){
				System.out.println(hako[i]);
			} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
				System.out.println(hako[i]);
			} {
				System.out.println(hako[i]);
			} System.out.println(hako[i]) System.out.println System.out System System.out hako[i] hako i String[] args args public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int w = Integer.parseInt(br.readLine());
			int n = Integer.parseInt(br.readLine());
			int hako[] = new int[w+1];
			int dami = 0;
			
			for(int i = 1;i <= w;i++){
				hako[i] = i;
			}
			
			for(int i = 0;i < n;i++){
				String line = br.readLine();
				int a[] = new int[2];
				String s[] = line.split(",",0);
				a[0] = Integer.parseInt(s[0]);
				a[1] = Integer.parseInt(s[1]);
				
				dami = hako[a[0]];
				hako[a[0]] = hako[a[1]];
				hako[a[1]] = dami;
			}
			
			for(int i = 1;i <= w;i++){
				System.out.println(hako[i]);
			}
	}
} public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int w = Integer.parseInt(br.readLine());
			int n = Integer.parseInt(br.readLine());
			int hako[] = new int[w+1];
			int dami = 0;
			
			for(int i = 1;i <= w;i++){
				hako[i] = i;
			}
			
			for(int i = 0;i < n;i++){
				String line = br.readLine();
				int a[] = new int[2];
				String s[] = line.split(",",0);
				a[0] = Integer.parseInt(s[0]);
				a[1] = Integer.parseInt(s[1]);
				
				dami = hako[a[0]];
				hako[a[0]] = hako[a[1]];
				hako[a[1]] = dami;
			}
			
			for(int i = 1;i <= w;i++){
				System.out.println(hako[i]);
			}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int w = Integer.parseInt(br.readLine());
			int n = Integer.parseInt(br.readLine());
			int hako[] = new int[w+1];
			int dami = 0;
			
			for(int i = 1;i <= w;i++){
				hako[i] = i;
			}
			
			for(int i = 0;i < n;i++){
				String line = br.readLine();
				int a[] = new int[2];
				String s[] = line.split(",",0);
				a[0] = Integer.parseInt(s[0]);
				a[1] = Integer.parseInt(s[1]);
				
				dami = hako[a[0]];
				hako[a[0]] = hako[a[1]];
				hako[a[1]] = dami;
			}
			
			for(int i = 1;i <= w;i++){
				System.out.println(hako[i]);
			}
	}
}