import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int w, n, a, b, tmp;
	int[] lots;
	String[] input;
	w = Integer.parseInt(scan.nextLine());
	n = Integer.parseInt(scan.nextLine());
	lots = new int[w + 1];
	for (int i = 1; i <= w; i++) {
	    lots[i] = i;
	}
	for (int i = 0; i < n; i++) {
	    input = scan.nextLine().split(",");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    tmp = lots[a];
	    lots[a] = lots[b];
	    lots[b] = tmp;
	}
	for (int i = 1; i <= w; i++) {
	    System.out.println(lots[i]);
	}
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int w, n, a, b, tmp;
	int[] lots;
	String[] input;
	w = Integer.parseInt(scan.nextLine());
	n = Integer.parseInt(scan.nextLine());
	lots = new int[w + 1];
	for (int i = 1; i <= w; i++) {
	    lots[i] = i;
	}
	for (int i = 0; i < n; i++) {
	    input = scan.nextLine().split(",");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    tmp = lots[a];
	    lots[a] = lots[b];
	    lots[b] = tmp;
	}
	for (int i = 1; i <= w; i++) {
	    System.out.println(lots[i]);
	}
    }
} Main public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int w, n, a, b, tmp;
	int[] lots;
	String[] input;
	w = Integer.parseInt(scan.nextLine());
	n = Integer.parseInt(scan.nextLine());
	lots = new int[w + 1];
	for (int i = 1; i <= w; i++) {
	    lots[i] = i;
	}
	for (int i = 0; i < n; i++) {
	    input = scan.nextLine().split(",");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    tmp = lots[a];
	    lots[a] = lots[b];
	    lots[b] = tmp;
	}
	for (int i = 1; i <= w; i++) {
	    System.out.println(lots[i]);
	}
    } main {
	Scanner scan = new Scanner(System.in);
	int w, n, a, b, tmp;
	int[] lots;
	String[] input;
	w = Integer.parseInt(scan.nextLine());
	n = Integer.parseInt(scan.nextLine());
	lots = new int[w + 1];
	for (int i = 1; i <= w; i++) {
	    lots[i] = i;
	}
	for (int i = 0; i < n; i++) {
	    input = scan.nextLine().split(",");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    tmp = lots[a];
	    lots[a] = lots[b];
	    lots[b] = tmp;
	}
	for (int i = 1; i <= w; i++) {
	    System.out.println(lots[i]);
	}
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w w n n a a b b tmp; tmp int[] lots; lots String[] input; input w = Integer.parseInt(scan.nextLine()) w Integer.parseInt(scan.nextLine()) Integer.parseInt Integer scan.nextLine() scan.nextLine scan n = Integer.parseInt(scan.nextLine()) n Integer.parseInt(scan.nextLine()) Integer.parseInt Integer scan.nextLine() scan.nextLine scan lots = new int[w + 1] lots new int[w + 1] w + 1 w 1 for (int i = 1; i <= w; i++) {
	    lots[i] = i;
	} int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
	    lots[i] = i;
	} {
	    lots[i] = i;
	} lots[i] = i lots[i] lots i i for (int i = 0; i < n; i++) {
	    input = scan.nextLine().split(",");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    tmp = lots[a];
	    lots[a] = lots[b];
	    lots[b] = tmp;
	} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
	    input = scan.nextLine().split(",");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    tmp = lots[a];
	    lots[a] = lots[b];
	    lots[b] = tmp;
	} {
	    input = scan.nextLine().split(",");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    tmp = lots[a];
	    lots[a] = lots[b];
	    lots[b] = tmp;
	} input = scan.nextLine().split(",") input scan.nextLine().split(",") scan.nextLine().split scan.nextLine() scan.nextLine scan "," a = Integer.parseInt(input[0]) a Integer.parseInt(input[0]) Integer.parseInt Integer input[0] input 0 b = Integer.parseInt(input[1]) b Integer.parseInt(input[1]) Integer.parseInt Integer input[1] input 1 tmp = lots[a] tmp lots[a] lots a lots[a] = lots[b] lots[a] lots a lots[b] lots b lots[b] = tmp lots[b] lots b tmp for (int i = 1; i <= w; i++) {
	    System.out.println(lots[i]);
	} int i = 1; int i = 1; i 1 i <= w i w 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) {
	Scanner scan = new Scanner(System.in);
	int w, n, a, b, tmp;
	int[] lots;
	String[] input;
	w = Integer.parseInt(scan.nextLine());
	n = Integer.parseInt(scan.nextLine());
	lots = new int[w + 1];
	for (int i = 1; i <= w; i++) {
	    lots[i] = i;
	}
	for (int i = 0; i < n; i++) {
	    input = scan.nextLine().split(",");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    tmp = lots[a];
	    lots[a] = lots[b];
	    lots[b] = tmp;
	}
	for (int i = 1; i <= w; i++) {
	    System.out.println(lots[i]);
	}
    }
} public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int w, n, a, b, tmp;
	int[] lots;
	String[] input;
	w = Integer.parseInt(scan.nextLine());
	n = Integer.parseInt(scan.nextLine());
	lots = new int[w + 1];
	for (int i = 1; i <= w; i++) {
	    lots[i] = i;
	}
	for (int i = 0; i < n; i++) {
	    input = scan.nextLine().split(",");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    tmp = lots[a];
	    lots[a] = lots[b];
	    lots[b] = tmp;
	}
	for (int i = 1; i <= w; i++) {
	    System.out.println(lots[i]);
	}
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int w, n, a, b, tmp;
	int[] lots;
	String[] input;
	w = Integer.parseInt(scan.nextLine());
	n = Integer.parseInt(scan.nextLine());
	lots = new int[w + 1];
	for (int i = 1; i <= w; i++) {
	    lots[i] = i;
	}
	for (int i = 0; i < n; i++) {
	    input = scan.nextLine().split(",");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    tmp = lots[a];
	    lots[a] = lots[b];
	    lots[b] = tmp;
	}
	for (int i = 1; i <= w; i++) {
	    System.out.println(lots[i]);
	}
    }
}