import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i = 0; i < n; i++) {
			String tmp = stdIn.next();
			String[] tmp2 = tmp.split(",");
			a[i] = Integer.parseInt(tmp2[0]);
			b[i] = Integer.parseInt(tmp2[1]);
		}
		int[] loc = new int[w];
		for(int i = 0; i < w; i++) {
			int p = i+1;
			for(int j = 0; j < n; j++) {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			}
			loc[p-1] = i+1;
		}
		
		for(int i = 0; i < w; i++) {
			System.out.println(loc[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i = 0; i < n; i++) {
			String tmp = stdIn.next();
			String[] tmp2 = tmp.split(",");
			a[i] = Integer.parseInt(tmp2[0]);
			b[i] = Integer.parseInt(tmp2[1]);
		}
		int[] loc = new int[w];
		for(int i = 0; i < w; i++) {
			int p = i+1;
			for(int j = 0; j < n; j++) {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			}
			loc[p-1] = i+1;
		}
		
		for(int i = 0; i < w; i++) {
			System.out.println(loc[i]);
		}
	}
} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i = 0; i < n; i++) {
			String tmp = stdIn.next();
			String[] tmp2 = tmp.split(",");
			a[i] = Integer.parseInt(tmp2[0]);
			b[i] = Integer.parseInt(tmp2[1]);
		}
		int[] loc = new int[w];
		for(int i = 0; i < w; i++) {
			int p = i+1;
			for(int j = 0; j < n; j++) {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			}
			loc[p-1] = i+1;
		}
		
		for(int i = 0; i < w; i++) {
			System.out.println(loc[i]);
		}
	} main {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i = 0; i < n; i++) {
			String tmp = stdIn.next();
			String[] tmp2 = tmp.split(",");
			a[i] = Integer.parseInt(tmp2[0]);
			b[i] = Integer.parseInt(tmp2[1]);
		}
		int[] loc = new int[w];
		for(int i = 0; i < w; i++) {
			int p = i+1;
			for(int j = 0; j < n; j++) {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			}
			loc[p-1] = i+1;
		}
		
		for(int i = 0; i < w; i++) {
			System.out.println(loc[i]);
		}
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int w = stdIn.nextInt(); w stdIn.nextInt() stdIn.nextInt stdIn int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int[] a = new int[n]; a new int[n] n int[] b = new int[n]; b new int[n] n for(int i = 0; i < n; i++) {
			String tmp = stdIn.next();
			String[] tmp2 = tmp.split(",");
			a[i] = Integer.parseInt(tmp2[0]);
			b[i] = Integer.parseInt(tmp2[1]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String tmp = stdIn.next();
			String[] tmp2 = tmp.split(",");
			a[i] = Integer.parseInt(tmp2[0]);
			b[i] = Integer.parseInt(tmp2[1]);
		} {
			String tmp = stdIn.next();
			String[] tmp2 = tmp.split(",");
			a[i] = Integer.parseInt(tmp2[0]);
			b[i] = Integer.parseInt(tmp2[1]);
		} String tmp = stdIn.next(); tmp stdIn.next() stdIn.next stdIn String[] tmp2 = tmp.split(","); tmp2 tmp.split(",") tmp.split tmp "," a[i] = Integer.parseInt(tmp2[0]) a[i] a i Integer.parseInt(tmp2[0]) Integer.parseInt Integer tmp2[0] tmp2 0 b[i] = Integer.parseInt(tmp2[1]) b[i] b i Integer.parseInt(tmp2[1]) Integer.parseInt Integer tmp2[1] tmp2 1 int[] loc = new int[w]; loc new int[w] w for(int i = 0; i < w; i++) {
			int p = i+1;
			for(int j = 0; j < n; j++) {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			}
			loc[p-1] = i+1;
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			int p = i+1;
			for(int j = 0; j < n; j++) {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			}
			loc[p-1] = i+1;
		} {
			int p = i+1;
			for(int j = 0; j < n; j++) {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			}
			loc[p-1] = i+1;
		} int p = i+1; p i+1 i 1 for(int j = 0; j < n; j++) {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			} {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			} if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				} a[j] == p a[j] a j p {
					p = b[j];
				} p = b[j] p b[j] b j if(b[j] == p) {
					p = a[j];
				} b[j] == p b[j] b j p {
					p = a[j];
				} p = a[j] p a[j] a j loc[p-1] = i+1 loc[p-1] loc p-1 p 1 i+1 i 1 for(int i = 0; i < w; i++) {
			System.out.println(loc[i]);
		} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			System.out.println(loc[i]);
		} {
			System.out.println(loc[i]);
		} System.out.println(loc[i]) System.out.println System.out System System.out loc[i] loc i String[] args args public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i = 0; i < n; i++) {
			String tmp = stdIn.next();
			String[] tmp2 = tmp.split(",");
			a[i] = Integer.parseInt(tmp2[0]);
			b[i] = Integer.parseInt(tmp2[1]);
		}
		int[] loc = new int[w];
		for(int i = 0; i < w; i++) {
			int p = i+1;
			for(int j = 0; j < n; j++) {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			}
			loc[p-1] = i+1;
		}
		
		for(int i = 0; i < w; i++) {
			System.out.println(loc[i]);
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i = 0; i < n; i++) {
			String tmp = stdIn.next();
			String[] tmp2 = tmp.split(",");
			a[i] = Integer.parseInt(tmp2[0]);
			b[i] = Integer.parseInt(tmp2[1]);
		}
		int[] loc = new int[w];
		for(int i = 0; i < w; i++) {
			int p = i+1;
			for(int j = 0; j < n; j++) {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			}
			loc[p-1] = i+1;
		}
		
		for(int i = 0; i < w; i++) {
			System.out.println(loc[i]);
		}
	}
} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i = 0; i < n; i++) {
			String tmp = stdIn.next();
			String[] tmp2 = tmp.split(",");
			a[i] = Integer.parseInt(tmp2[0]);
			b[i] = Integer.parseInt(tmp2[1]);
		}
		int[] loc = new int[w];
		for(int i = 0; i < w; i++) {
			int p = i+1;
			for(int j = 0; j < n; j++) {
				if(a[j] == p) {
					p = b[j];
				}
				else if(b[j] == p) {
					p = a[j];
				}
			}
			loc[p-1] = i+1;
		}
		
		for(int i = 0; i < w; i++) {
			System.out.println(loc[i]);
		}
	}
}