import java.util.Scanner;

class Main {
    public static void main (String args[]) {
	Scanner scan = new Scanner(System.in);
	scan.useDelimiter(",|\n");
	int n = scan.nextInt();
	int m = scan.nextInt();
	int[] seq = new int[n];

	for (int i=0; i<n; i++) {
	    seq[i] = i+1;
	}

        for (int i=0; i<m; i++) {
	    int a = scan.nextInt() - 1;
	    int b = scan.nextInt() - 1;
	    
	    int tmp = seq[a];
	    seq[a] = seq[b];
	    seq[b] = tmp;
	}

	for (int data: seq) {
	    System.out.println(data);
	}
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main (String args[]) {
	Scanner scan = new Scanner(System.in);
	scan.useDelimiter(",|\n");
	int n = scan.nextInt();
	int m = scan.nextInt();
	int[] seq = new int[n];

	for (int i=0; i<n; i++) {
	    seq[i] = i+1;
	}

        for (int i=0; i<m; i++) {
	    int a = scan.nextInt() - 1;
	    int b = scan.nextInt() - 1;
	    
	    int tmp = seq[a];
	    seq[a] = seq[b];
	    seq[b] = tmp;
	}

	for (int data: seq) {
	    System.out.println(data);
	}
    }
} Main public static void main (String args[]) {
	Scanner scan = new Scanner(System.in);
	scan.useDelimiter(",|\n");
	int n = scan.nextInt();
	int m = scan.nextInt();
	int[] seq = new int[n];

	for (int i=0; i<n; i++) {
	    seq[i] = i+1;
	}

        for (int i=0; i<m; i++) {
	    int a = scan.nextInt() - 1;
	    int b = scan.nextInt() - 1;
	    
	    int tmp = seq[a];
	    seq[a] = seq[b];
	    seq[b] = tmp;
	}

	for (int data: seq) {
	    System.out.println(data);
	}
    } main {
	Scanner scan = new Scanner(System.in);
	scan.useDelimiter(",|\n");
	int n = scan.nextInt();
	int m = scan.nextInt();
	int[] seq = new int[n];

	for (int i=0; i<n; i++) {
	    seq[i] = i+1;
	}

        for (int i=0; i<m; i++) {
	    int a = scan.nextInt() - 1;
	    int b = scan.nextInt() - 1;
	    
	    int tmp = seq[a];
	    seq[a] = seq[b];
	    seq[b] = tmp;
	}

	for (int data: seq) {
	    System.out.println(data);
	}
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) scan.useDelimiter(",|\n") scan.useDelimiter scan ",|\n" int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan int[] seq = new int[n]; seq new int[n] n for (int i=0; i<n; i++) {
	    seq[i] = i+1;
	} int i=0; int i=0; i 0 i<n i n 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<m; i++) {
	    int a = scan.nextInt() - 1;
	    int b = scan.nextInt() - 1;
	    
	    int tmp = seq[a];
	    seq[a] = seq[b];
	    seq[b] = tmp;
	} int i=0; int i=0; i 0 i<m i m i++ i++ i {
	    int a = scan.nextInt() - 1;
	    int b = scan.nextInt() - 1;
	    
	    int tmp = seq[a];
	    seq[a] = seq[b];
	    seq[b] = tmp;
	} {
	    int a = scan.nextInt() - 1;
	    int b = scan.nextInt() - 1;
	    
	    int tmp = seq[a];
	    seq[a] = seq[b];
	    seq[b] = tmp;
	} int a = scan.nextInt() - 1; a scan.nextInt() - 1 scan.nextInt() scan.nextInt scan 1 int b = scan.nextInt() - 1; b scan.nextInt() - 1 scan.nextInt() scan.nextInt scan 1 int tmp = seq[a]; tmp seq[a] seq a seq[a] = seq[b] seq[a] seq a seq[b] seq b seq[b] = tmp seq[b] seq b tmp for (int data: seq) {
	    System.out.println(data);
	} int data seq {
	    System.out.println(data);
	} {
	    System.out.println(data);
	} System.out.println(data) System.out.println System.out System System.out data String args[] args
import java.util.Scanner;

class Main {
    public static void main (String args[]) {
	Scanner scan = new Scanner(System.in);
	scan.useDelimiter(",|\n");
	int n = scan.nextInt();
	int m = scan.nextInt();
	int[] seq = new int[n];

	for (int i=0; i<n; i++) {
	    seq[i] = i+1;
	}

        for (int i=0; i<m; i++) {
	    int a = scan.nextInt() - 1;
	    int b = scan.nextInt() - 1;
	    
	    int tmp = seq[a];
	    seq[a] = seq[b];
	    seq[b] = tmp;
	}

	for (int data: seq) {
	    System.out.println(data);
	}
    }
}