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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] seq = new int[w];
		for(int i = 0; i < seq.length;i++){
			seq[i] = i+1;
		}
		for(int i = 0 ; i < n;i++){
			String[] s= br.readLine().split(",");
			int a=Integer.parseInt(s[0]);
			int b=Integer.parseInt(s[1]);
			int c = seq[a-1];
			seq[a-1] = seq[b-1];
			seq[b-1] = c;
		}
		for(int i = 0; i<seq.length;i++){
			System.out.println(seq[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 NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] seq = new int[w];
		for(int i = 0; i < seq.length;i++){
			seq[i] = i+1;
		}
		for(int i = 0 ; i < n;i++){
			String[] s= br.readLine().split(",");
			int a=Integer.parseInt(s[0]);
			int b=Integer.parseInt(s[1]);
			int c = seq[a-1];
			seq[a-1] = seq[b-1];
			seq[b-1] = c;
		}
		for(int i = 0; i<seq.length;i++){
			System.out.println(seq[i]);
		}
	}

} Main public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] seq = new int[w];
		for(int i = 0; i < seq.length;i++){
			seq[i] = i+1;
		}
		for(int i = 0 ; i < n;i++){
			String[] s= br.readLine().split(",");
			int a=Integer.parseInt(s[0]);
			int b=Integer.parseInt(s[1]);
			int c = seq[a-1];
			seq[a-1] = seq[b-1];
			seq[b-1] = c;
		}
		for(int i = 0; i<seq.length;i++){
			System.out.println(seq[i]);
		}
	} main {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] seq = new int[w];
		for(int i = 0; i < seq.length;i++){
			seq[i] = i+1;
		}
		for(int i = 0 ; i < n;i++){
			String[] s= br.readLine().split(",");
			int a=Integer.parseInt(s[0]);
			int b=Integer.parseInt(s[1]);
			int c = seq[a-1];
			seq[a-1] = seq[b-1];
			seq[b-1] = c;
		}
		for(int i = 0; i<seq.length;i++){
			System.out.println(seq[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[] seq = new int[w]; seq new int[w] w for(int i = 0; i < seq.length;i++){
			seq[i] = i+1;
		} int i = 0; int i = 0; i 0 i < seq.length i seq.length seq seq.length i++ i++ i {
			seq[i] = i+1;
		} {
			seq[i] = i+1;
		} seq[i] = i+1 seq[i] seq i i+1 i 1 for(int i = 0 ; i < n;i++){
			String[] s= br.readLine().split(",");
			int a=Integer.parseInt(s[0]);
			int b=Integer.parseInt(s[1]);
			int c = seq[a-1];
			seq[a-1] = seq[b-1];
			seq[b-1] = c;
		} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
			String[] s= br.readLine().split(",");
			int a=Integer.parseInt(s[0]);
			int b=Integer.parseInt(s[1]);
			int c = seq[a-1];
			seq[a-1] = seq[b-1];
			seq[b-1] = c;
		} {
			String[] s= br.readLine().split(",");
			int a=Integer.parseInt(s[0]);
			int b=Integer.parseInt(s[1]);
			int c = seq[a-1];
			seq[a-1] = seq[b-1];
			seq[b-1] = c;
		} String[] s= br.readLine().split(","); s br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," int a=Integer.parseInt(s[0]); a Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int b=Integer.parseInt(s[1]); b Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 int c = seq[a-1]; c seq[a-1] seq a-1 a 1 seq[a-1] = seq[b-1] seq[a-1] seq a-1 a 1 seq[b-1] seq b-1 b 1 seq[b-1] = c seq[b-1] seq b-1 b 1 c for(int i = 0; i<seq.length;i++){
			System.out.println(seq[i]);
		} int i = 0; int i = 0; i 0 i<seq.length i seq.length seq seq.length i++ i++ i {
			System.out.println(seq[i]);
		} {
			System.out.println(seq[i]);
		} System.out.println(seq[i]) System.out.println System.out System System.out seq[i] seq i String[] args args public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] seq = new int[w];
		for(int i = 0; i < seq.length;i++){
			seq[i] = i+1;
		}
		for(int i = 0 ; i < n;i++){
			String[] s= br.readLine().split(",");
			int a=Integer.parseInt(s[0]);
			int b=Integer.parseInt(s[1]);
			int c = seq[a-1];
			seq[a-1] = seq[b-1];
			seq[b-1] = c;
		}
		for(int i = 0; i<seq.length;i++){
			System.out.println(seq[i]);
		}
	}

} public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] seq = new int[w];
		for(int i = 0; i < seq.length;i++){
			seq[i] = i+1;
		}
		for(int i = 0 ; i < n;i++){
			String[] s= br.readLine().split(",");
			int a=Integer.parseInt(s[0]);
			int b=Integer.parseInt(s[1]);
			int c = seq[a-1];
			seq[a-1] = seq[b-1];
			seq[b-1] = c;
		}
		for(int i = 0; i<seq.length;i++){
			System.out.println(seq[i]);
		}
	}

} Main

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] seq = new int[w];
		for(int i = 0; i < seq.length;i++){
			seq[i] = i+1;
		}
		for(int i = 0 ; i < n;i++){
			String[] s= br.readLine().split(",");
			int a=Integer.parseInt(s[0]);
			int b=Integer.parseInt(s[1]);
			int c = seq[a-1];
			seq[a-1] = seq[b-1];
			seq[b-1] = c;
		}
		for(int i = 0; i<seq.length;i++){
			System.out.println(seq[i]);
		}
	}

}