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[] bufbuf;
		int[] buf;
		for(int i = 0;i < n;i++){
			bufbuf = br.readLine().split(",");
			buf = new int[bufbuf.length];
			for(int j = 0;j < bufbuf.length;j++){
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			}
			int tmp = lots[buf[0]];
			lots[buf[0]] = lots[buf[1]];
			lots[buf[1]] = 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[] bufbuf;
		int[] buf;
		for(int i = 0;i < n;i++){
			bufbuf = br.readLine().split(",");
			buf = new int[bufbuf.length];
			for(int j = 0;j < bufbuf.length;j++){
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			}
			int tmp = lots[buf[0]];
			lots[buf[0]] = lots[buf[1]];
			lots[buf[1]] = 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[] bufbuf;
		int[] buf;
		for(int i = 0;i < n;i++){
			bufbuf = br.readLine().split(",");
			buf = new int[bufbuf.length];
			for(int j = 0;j < bufbuf.length;j++){
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			}
			int tmp = lots[buf[0]];
			lots[buf[0]] = lots[buf[1]];
			lots[buf[1]] = 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[] bufbuf;
		int[] buf;
		for(int i = 0;i < n;i++){
			bufbuf = br.readLine().split(",");
			buf = new int[bufbuf.length];
			for(int j = 0;j < bufbuf.length;j++){
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			}
			int tmp = lots[buf[0]];
			lots[buf[0]] = lots[buf[1]];
			lots[buf[1]] = 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[] bufbuf; bufbuf int[] buf; buf for(int i = 0;i < n;i++){
			bufbuf = br.readLine().split(",");
			buf = new int[bufbuf.length];
			for(int j = 0;j < bufbuf.length;j++){
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			}
			int tmp = lots[buf[0]];
			lots[buf[0]] = lots[buf[1]];
			lots[buf[1]] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			bufbuf = br.readLine().split(",");
			buf = new int[bufbuf.length];
			for(int j = 0;j < bufbuf.length;j++){
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			}
			int tmp = lots[buf[0]];
			lots[buf[0]] = lots[buf[1]];
			lots[buf[1]] = tmp;
		} {
			bufbuf = br.readLine().split(",");
			buf = new int[bufbuf.length];
			for(int j = 0;j < bufbuf.length;j++){
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			}
			int tmp = lots[buf[0]];
			lots[buf[0]] = lots[buf[1]];
			lots[buf[1]] = tmp;
		} bufbuf = br.readLine().split(",") bufbuf br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," buf = new int[bufbuf.length] buf new int[bufbuf.length] bufbuf.length bufbuf bufbuf.length for(int j = 0;j < bufbuf.length;j++){
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			} int j = 0; int j = 0; j 0 j < bufbuf.length j bufbuf.length bufbuf bufbuf.length j++ j++ j {
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			} {
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			} buf[j] = Integer.parseInt(bufbuf[j])-1 buf[j] buf j Integer.parseInt(bufbuf[j])-1 Integer.parseInt(bufbuf[j]) Integer.parseInt Integer bufbuf[j] bufbuf j 1 int tmp = lots[buf[0]]; tmp lots[buf[0]] lots buf[0] buf 0 lots[buf[0]] = lots[buf[1]] lots[buf[0]] lots buf[0] buf 0 lots[buf[1]] lots buf[1] buf 1 lots[buf[1]] = tmp lots[buf[1]] lots buf[1] buf 1 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[] bufbuf;
		int[] buf;
		for(int i = 0;i < n;i++){
			bufbuf = br.readLine().split(",");
			buf = new int[bufbuf.length];
			for(int j = 0;j < bufbuf.length;j++){
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			}
			int tmp = lots[buf[0]];
			lots[buf[0]] = lots[buf[1]];
			lots[buf[1]] = 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[] bufbuf;
		int[] buf;
		for(int i = 0;i < n;i++){
			bufbuf = br.readLine().split(",");
			buf = new int[bufbuf.length];
			for(int j = 0;j < bufbuf.length;j++){
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			}
			int tmp = lots[buf[0]];
			lots[buf[0]] = lots[buf[1]];
			lots[buf[1]] = 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[] bufbuf;
		int[] buf;
		for(int i = 0;i < n;i++){
			bufbuf = br.readLine().split(",");
			buf = new int[bufbuf.length];
			for(int j = 0;j < bufbuf.length;j++){
				buf[j] = Integer.parseInt(bufbuf[j])-1;
			}
			int tmp = lots[buf[0]];
			lots[buf[0]] = lots[buf[1]];
			lots[buf[1]] = tmp;
		}
		for(int i = 0;i < lots.length;i++){
			System.out.println(lots[i]);
		}
	}
}