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

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] lots = new int[w];
		for(int i = 0;i < lots.length;i++){
			lots[i] = i + 1;
		}
		String[] buf;
		int leader, trailer;
		for(int i = 0;i < n;i++){
			buf = br.readLine().split(",");
			leader = Integer.parseInt(buf[0]) - 1;
			trailer = Integer.parseInt(buf[1]) - 1;
			int tmp = lots[leader];
			lots[leader] = lots[trailer];
			lots[trailer] = tmp;
		}
		for(int i = 0;i < lots.length;i++){
			System.out.println(lots[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 {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] lots = new int[w];
		for(int i = 0;i < lots.length;i++){
			lots[i] = i + 1;
		}
		String[] buf;
		int leader, trailer;
		for(int i = 0;i < n;i++){
			buf = br.readLine().split(",");
			leader = Integer.parseInt(buf[0]) - 1;
			trailer = Integer.parseInt(buf[1]) - 1;
			int tmp = lots[leader];
			lots[leader] = lots[trailer];
			lots[trailer] = tmp;
		}
		for(int i = 0;i < lots.length;i++){
			System.out.println(lots[i]);
		}
	}
} Main public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] lots = new int[w];
		for(int i = 0;i < lots.length;i++){
			lots[i] = i + 1;
		}
		String[] buf;
		int leader, trailer;
		for(int i = 0;i < n;i++){
			buf = br.readLine().split(",");
			leader = Integer.parseInt(buf[0]) - 1;
			trailer = Integer.parseInt(buf[1]) - 1;
			int tmp = lots[leader];
			lots[leader] = lots[trailer];
			lots[trailer] = tmp;
		}
		for(int i = 0;i < lots.length;i++){
			System.out.println(lots[i]);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] lots = new int[w];
		for(int i = 0;i < lots.length;i++){
			lots[i] = i + 1;
		}
		String[] buf;
		int leader, trailer;
		for(int i = 0;i < n;i++){
			buf = br.readLine().split(",");
			leader = Integer.parseInt(buf[0]) - 1;
			trailer = Integer.parseInt(buf[1]) - 1;
			int tmp = lots[leader];
			lots[leader] = lots[trailer];
			lots[trailer] = tmp;
		}
		for(int i = 0;i < lots.length;i++){
			System.out.println(lots[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[] lots = new int[w]; lots new int[w] w for(int i = 0;i < lots.length;i++){
			lots[i] = i + 1;
		} int i = 0; int i = 0; i 0 i < lots.length i lots.length lots lots.length i++ i++ i {
			lots[i] = i + 1;
		} {
			lots[i] = i + 1;
		} lots[i] = i + 1 lots[i] lots i i + 1 i 1 String[] buf; buf int leader leader trailer; trailer for(int i = 0;i < n;i++){
			buf = br.readLine().split(",");
			leader = Integer.parseInt(buf[0]) - 1;
			trailer = Integer.parseInt(buf[1]) - 1;
			int tmp = lots[leader];
			lots[leader] = lots[trailer];
			lots[trailer] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			buf = br.readLine().split(",");
			leader = Integer.parseInt(buf[0]) - 1;
			trailer = Integer.parseInt(buf[1]) - 1;
			int tmp = lots[leader];
			lots[leader] = lots[trailer];
			lots[trailer] = tmp;
		} {
			buf = br.readLine().split(",");
			leader = Integer.parseInt(buf[0]) - 1;
			trailer = Integer.parseInt(buf[1]) - 1;
			int tmp = lots[leader];
			lots[leader] = lots[trailer];
			lots[trailer] = tmp;
		} buf = br.readLine().split(",") buf br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," leader = Integer.parseInt(buf[0]) - 1 leader Integer.parseInt(buf[0]) - 1 Integer.parseInt(buf[0]) Integer.parseInt Integer buf[0] buf 0 1 trailer = Integer.parseInt(buf[1]) - 1 trailer Integer.parseInt(buf[1]) - 1 Integer.parseInt(buf[1]) Integer.parseInt Integer buf[1] buf 1 1 int tmp = lots[leader]; tmp lots[leader] lots leader lots[leader] = lots[trailer] lots[leader] lots leader lots[trailer] lots trailer lots[trailer] = tmp lots[trailer] lots trailer tmp for(int i = 0;i < lots.length;i++){
			System.out.println(lots[i]);
		} int i = 0; int i = 0; i 0 i < lots.length i lots.length lots lots.length i++ i++ i {
			System.out.println(lots[i]);
		} {
			System.out.println(lots[i]);
		} System.out.println(lots[i]) System.out.println System.out System System.out lots[i] lots i String[] args args public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] lots = new int[w];
		for(int i = 0;i < lots.length;i++){
			lots[i] = i + 1;
		}
		String[] buf;
		int leader, trailer;
		for(int i = 0;i < n;i++){
			buf = br.readLine().split(",");
			leader = Integer.parseInt(buf[0]) - 1;
			trailer = Integer.parseInt(buf[1]) - 1;
			int tmp = lots[leader];
			lots[leader] = lots[trailer];
			lots[trailer] = tmp;
		}
		for(int i = 0;i < lots.length;i++){
			System.out.println(lots[i]);
		}
	}
} public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] lots = new int[w];
		for(int i = 0;i < lots.length;i++){
			lots[i] = i + 1;
		}
		String[] buf;
		int leader, trailer;
		for(int i = 0;i < n;i++){
			buf = br.readLine().split(",");
			leader = Integer.parseInt(buf[0]) - 1;
			trailer = Integer.parseInt(buf[1]) - 1;
			int tmp = lots[leader];
			lots[leader] = lots[trailer];
			lots[trailer] = tmp;
		}
		for(int i = 0;i < lots.length;i++){
			System.out.println(lots[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 {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int w = Integer.parseInt(br.readLine());
		int n = Integer.parseInt(br.readLine());
		int[] lots = new int[w];
		for(int i = 0;i < lots.length;i++){
			lots[i] = i + 1;
		}
		String[] buf;
		int leader, trailer;
		for(int i = 0;i < n;i++){
			buf = br.readLine().split(",");
			leader = Integer.parseInt(buf[0]) - 1;
			trailer = Integer.parseInt(buf[1]) - 1;
			int tmp = lots[leader];
			lots[leader] = lots[trailer];
			lots[trailer] = tmp;
		}
		for(int i = 0;i < lots.length;i++){
			System.out.println(lots[i]);
		}
	}
}