import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int d;
	int w = sc.nextInt();
	int n = sc.nextInt();
	int[] line;
	int[] a;
	line = new int[w];
	a = new int[2];
	for(int i=0;i<w;i++) line[i] = i+1;
	for(int i=0;i<n;i++){
	    String s = sc.next();
	    int l = s.length();
	    int k = 0, f=0, x=0;
	    for(int j=0;j<l;j++){
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    }
	    a[1] = Integer.parseInt(s.substring(x,l));
	    d = line[a[0]-1];
	    line[a[0]-1] = line[a[1]-1];
	    line[a[1]-1] = d;
	}
	for(int i=0;i<w;i++) System.out.println(line[i]);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int d;
	int w = sc.nextInt();
	int n = sc.nextInt();
	int[] line;
	int[] a;
	line = new int[w];
	a = new int[2];
	for(int i=0;i<w;i++) line[i] = i+1;
	for(int i=0;i<n;i++){
	    String s = sc.next();
	    int l = s.length();
	    int k = 0, f=0, x=0;
	    for(int j=0;j<l;j++){
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    }
	    a[1] = Integer.parseInt(s.substring(x,l));
	    d = line[a[0]-1];
	    line[a[0]-1] = line[a[1]-1];
	    line[a[1]-1] = d;
	}
	for(int i=0;i<w;i++) System.out.println(line[i]);
    }
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int d;
	int w = sc.nextInt();
	int n = sc.nextInt();
	int[] line;
	int[] a;
	line = new int[w];
	a = new int[2];
	for(int i=0;i<w;i++) line[i] = i+1;
	for(int i=0;i<n;i++){
	    String s = sc.next();
	    int l = s.length();
	    int k = 0, f=0, x=0;
	    for(int j=0;j<l;j++){
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    }
	    a[1] = Integer.parseInt(s.substring(x,l));
	    d = line[a[0]-1];
	    line[a[0]-1] = line[a[1]-1];
	    line[a[1]-1] = d;
	}
	for(int i=0;i<w;i++) System.out.println(line[i]);
    } main {
	Scanner sc = new Scanner(System.in);
	int d;
	int w = sc.nextInt();
	int n = sc.nextInt();
	int[] line;
	int[] a;
	line = new int[w];
	a = new int[2];
	for(int i=0;i<w;i++) line[i] = i+1;
	for(int i=0;i<n;i++){
	    String s = sc.next();
	    int l = s.length();
	    int k = 0, f=0, x=0;
	    for(int j=0;j<l;j++){
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    }
	    a[1] = Integer.parseInt(s.substring(x,l));
	    d = line[a[0]-1];
	    line[a[0]-1] = line[a[1]-1];
	    line[a[1]-1] = d;
	}
	for(int i=0;i<w;i++) System.out.println(line[i]);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int d; d int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] line; line int[] a; a line = new int[w] line new int[w] w a = new int[2] a new int[2] 2 for(int i=0;i<w;i++) line[i] = i+1; int i=0; int i=0; i 0 i<w i w i++ i++ i line[i] = i+1; line[i] = i+1 line[i] line i i+1 i 1 for(int i=0;i<n;i++){
	    String s = sc.next();
	    int l = s.length();
	    int k = 0, f=0, x=0;
	    for(int j=0;j<l;j++){
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    }
	    a[1] = Integer.parseInt(s.substring(x,l));
	    d = line[a[0]-1];
	    line[a[0]-1] = line[a[1]-1];
	    line[a[1]-1] = d;
	} int i=0; int i=0; i 0 i<n i n i++ i++ i {
	    String s = sc.next();
	    int l = s.length();
	    int k = 0, f=0, x=0;
	    for(int j=0;j<l;j++){
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    }
	    a[1] = Integer.parseInt(s.substring(x,l));
	    d = line[a[0]-1];
	    line[a[0]-1] = line[a[1]-1];
	    line[a[1]-1] = d;
	} {
	    String s = sc.next();
	    int l = s.length();
	    int k = 0, f=0, x=0;
	    for(int j=0;j<l;j++){
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    }
	    a[1] = Integer.parseInt(s.substring(x,l));
	    d = line[a[0]-1];
	    line[a[0]-1] = line[a[1]-1];
	    line[a[1]-1] = d;
	} String s = sc.next(); s sc.next() sc.next sc int l = s.length(); l s.length() s.length s int k = 0 k 0 f=0 f 0 x=0; x 0 for(int j=0;j<l;j++){
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    } int j=0; int j=0; j 0 j<l j l j++ j++ j {
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    } {
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    } char c = s.charAt(j); c s.charAt(j) s.charAt s j if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		} '0' > c || c > '9' '0' > c '0' c c > '9' c '9' {
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		} a[k] = Integer.parseInt(s.substring(x,j)) a[k] a k Integer.parseInt(s.substring(x,j)) Integer.parseInt Integer s.substring(x,j) s.substring s x j k++ k f=0 f 0 {
		    if(f==0){
			x=j;
			f=1;
		    } 
		} if(f==0){
			x=j;
			f=1;
		    } f==0 f 0 {
			x=j;
			f=1;
		    } x=j x j f=1 f 1 a[1] = Integer.parseInt(s.substring(x,l)) a[1] a 1 Integer.parseInt(s.substring(x,l)) Integer.parseInt Integer s.substring(x,l) s.substring s x l d = line[a[0]-1] d line[a[0]-1] line a[0]-1 a[0] a 0 1 line[a[0]-1] = line[a[1]-1] line[a[0]-1] line a[0]-1 a[0] a 0 1 line[a[1]-1] line a[1]-1 a[1] a 1 1 line[a[1]-1] = d line[a[1]-1] line a[1]-1 a[1] a 1 1 d for(int i=0;i<w;i++) System.out.println(line[i]); int i=0; int i=0; i 0 i<w i w i++ i++ i System.out.println(line[i]); System.out.println(line[i]) System.out.println System.out System System.out line[i] line i String[] args args public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int d;
	int w = sc.nextInt();
	int n = sc.nextInt();
	int[] line;
	int[] a;
	line = new int[w];
	a = new int[2];
	for(int i=0;i<w;i++) line[i] = i+1;
	for(int i=0;i<n;i++){
	    String s = sc.next();
	    int l = s.length();
	    int k = 0, f=0, x=0;
	    for(int j=0;j<l;j++){
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    }
	    a[1] = Integer.parseInt(s.substring(x,l));
	    d = line[a[0]-1];
	    line[a[0]-1] = line[a[1]-1];
	    line[a[1]-1] = d;
	}
	for(int i=0;i<w;i++) System.out.println(line[i]);
    }
} public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int d;
	int w = sc.nextInt();
	int n = sc.nextInt();
	int[] line;
	int[] a;
	line = new int[w];
	a = new int[2];
	for(int i=0;i<w;i++) line[i] = i+1;
	for(int i=0;i<n;i++){
	    String s = sc.next();
	    int l = s.length();
	    int k = 0, f=0, x=0;
	    for(int j=0;j<l;j++){
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    }
	    a[1] = Integer.parseInt(s.substring(x,l));
	    d = line[a[0]-1];
	    line[a[0]-1] = line[a[1]-1];
	    line[a[1]-1] = d;
	}
	for(int i=0;i<w;i++) System.out.println(line[i]);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int d;
	int w = sc.nextInt();
	int n = sc.nextInt();
	int[] line;
	int[] a;
	line = new int[w];
	a = new int[2];
	for(int i=0;i<w;i++) line[i] = i+1;
	for(int i=0;i<n;i++){
	    String s = sc.next();
	    int l = s.length();
	    int k = 0, f=0, x=0;
	    for(int j=0;j<l;j++){
		char c = s.charAt(j);
		if('0' > c || c > '9'){
		    a[k] = Integer.parseInt(s.substring(x,j));
		     k++;
		     f=0;
		}else{
		    if(f==0){
			x=j;
			f=1;
		    } 
		}
	    }
	    a[1] = Integer.parseInt(s.substring(x,l));
	    d = line[a[0]-1];
	    line[a[0]-1] = line[a[1]-1];
	    line[a[1]-1] = d;
	}
	for(int i=0;i<w;i++) System.out.println(line[i]);
    }
}