import java.io.IOException;
import java.util.Scanner;

public class Main  {

    static void swapidx(int[] arr, int lhs, int rhs){
    	int tmp = arr[lhs];
    	arr[lhs] = arr[rhs];
    	arr[rhs] = tmp;
    	return;
    }
    
    public static void main(String [] args){
    	Scanner sc = new Scanner(System.in);
    	int w = sc.nextInt();
    	int n = sc.nextInt();

    	int[] lines = new int[w];
    	for(int i=0; i<lines.length;++i){
    	    lines[i] = i + 1;
    	}
	sc.nextLine();
    	for(int i=0; i<n;++i){
	    String line = sc.nextLine();
	    String[] ints = line.split(",");
	    // System.out.println(line);
	    int a = Integer.parseInt(ints[0]);
	    int b = Integer.parseInt(ints[1]);
	    swapidx(lines, a - 1, b - 1);
    	}
	for(int i=0; i<lines.length;++i){
	    System.out.println(lines[i]);
	}
    }

} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main  {

    static void swapidx(int[] arr, int lhs, int rhs){
    	int tmp = arr[lhs];
    	arr[lhs] = arr[rhs];
    	arr[rhs] = tmp;
    	return;
    }
    
    public static void main(String [] args){
    	Scanner sc = new Scanner(System.in);
    	int w = sc.nextInt();
    	int n = sc.nextInt();

    	int[] lines = new int[w];
    	for(int i=0; i<lines.length;++i){
    	    lines[i] = i + 1;
    	}
	sc.nextLine();
    	for(int i=0; i<n;++i){
	    String line = sc.nextLine();
	    String[] ints = line.split(",");
	    // System.out.println(line);
	    int a = Integer.parseInt(ints[0]);
	    int b = Integer.parseInt(ints[1]);
	    swapidx(lines, a - 1, b - 1);
    	}
	for(int i=0; i<lines.length;++i){
	    System.out.println(lines[i]);
	}
    }

} Main static void swapidx(int[] arr, int lhs, int rhs){
    	int tmp = arr[lhs];
    	arr[lhs] = arr[rhs];
    	arr[rhs] = tmp;
    	return;
    } swapidx {
    	int tmp = arr[lhs];
    	arr[lhs] = arr[rhs];
    	arr[rhs] = tmp;
    	return;
    } int tmp = arr[lhs]; tmp arr[lhs] arr lhs arr[lhs] = arr[rhs] arr[lhs] arr lhs arr[rhs] arr rhs arr[rhs] = tmp arr[rhs] arr rhs tmp return; int[] arr arr int lhs lhs int rhs rhs public static void main(String [] args){
    	Scanner sc = new Scanner(System.in);
    	int w = sc.nextInt();
    	int n = sc.nextInt();

    	int[] lines = new int[w];
    	for(int i=0; i<lines.length;++i){
    	    lines[i] = i + 1;
    	}
	sc.nextLine();
    	for(int i=0; i<n;++i){
	    String line = sc.nextLine();
	    String[] ints = line.split(",");
	    // System.out.println(line);
	    int a = Integer.parseInt(ints[0]);
	    int b = Integer.parseInt(ints[1]);
	    swapidx(lines, a - 1, b - 1);
    	}
	for(int i=0; i<lines.length;++i){
	    System.out.println(lines[i]);
	}
    } main {
    	Scanner sc = new Scanner(System.in);
    	int w = sc.nextInt();
    	int n = sc.nextInt();

    	int[] lines = new int[w];
    	for(int i=0; i<lines.length;++i){
    	    lines[i] = i + 1;
    	}
	sc.nextLine();
    	for(int i=0; i<n;++i){
	    String line = sc.nextLine();
	    String[] ints = line.split(",");
	    // System.out.println(line);
	    int a = Integer.parseInt(ints[0]);
	    int b = Integer.parseInt(ints[1]);
	    swapidx(lines, a - 1, b - 1);
    	}
	for(int i=0; i<lines.length;++i){
	    System.out.println(lines[i]);
	}
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] lines = new int[w]; lines new int[w] w for(int i=0; i<lines.length;++i){
    	    lines[i] = i + 1;
    	} int i=0; int i=0; i 0 i<lines.length i lines.length lines lines.length ++i ++i i {
    	    lines[i] = i + 1;
    	} {
    	    lines[i] = i + 1;
    	} lines[i] = i + 1 lines[i] lines i i + 1 i 1 sc.nextLine() sc.nextLine sc for(int i=0; i<n;++i){
	    String line = sc.nextLine();
	    String[] ints = line.split(",");
	    // System.out.println(line);
	    int a = Integer.parseInt(ints[0]);
	    int b = Integer.parseInt(ints[1]);
	    swapidx(lines, a - 1, b - 1);
    	} int i=0; int i=0; i 0 i<n i n ++i ++i i {
	    String line = sc.nextLine();
	    String[] ints = line.split(",");
	    // System.out.println(line);
	    int a = Integer.parseInt(ints[0]);
	    int b = Integer.parseInt(ints[1]);
	    swapidx(lines, a - 1, b - 1);
    	} {
	    String line = sc.nextLine();
	    String[] ints = line.split(",");
	    // System.out.println(line);
	    int a = Integer.parseInt(ints[0]);
	    int b = Integer.parseInt(ints[1]);
	    swapidx(lines, a - 1, b - 1);
    	} String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String[] ints = line.split(","); ints line.split(",") line.split line "," int a = Integer.parseInt(ints[0]); a Integer.parseInt(ints[0]) Integer.parseInt Integer ints[0] ints 0 int b = Integer.parseInt(ints[1]); b Integer.parseInt(ints[1]) Integer.parseInt Integer ints[1] ints 1 swapidx(lines, a - 1, b - 1) swapidx lines a - 1 a 1 b - 1 b 1 for(int i=0; i<lines.length;++i){
	    System.out.println(lines[i]);
	} int i=0; int i=0; i 0 i<lines.length i lines.length lines lines.length ++i ++i i {
	    System.out.println(lines[i]);
	} {
	    System.out.println(lines[i]);
	} System.out.println(lines[i]) System.out.println System.out System System.out lines[i] lines i String [] args args public class Main  {

    static void swapidx(int[] arr, int lhs, int rhs){
    	int tmp = arr[lhs];
    	arr[lhs] = arr[rhs];
    	arr[rhs] = tmp;
    	return;
    }
    
    public static void main(String [] args){
    	Scanner sc = new Scanner(System.in);
    	int w = sc.nextInt();
    	int n = sc.nextInt();

    	int[] lines = new int[w];
    	for(int i=0; i<lines.length;++i){
    	    lines[i] = i + 1;
    	}
	sc.nextLine();
    	for(int i=0; i<n;++i){
	    String line = sc.nextLine();
	    String[] ints = line.split(",");
	    // System.out.println(line);
	    int a = Integer.parseInt(ints[0]);
	    int b = Integer.parseInt(ints[1]);
	    swapidx(lines, a - 1, b - 1);
    	}
	for(int i=0; i<lines.length;++i){
	    System.out.println(lines[i]);
	}
    }

} public class Main  {

    static void swapidx(int[] arr, int lhs, int rhs){
    	int tmp = arr[lhs];
    	arr[lhs] = arr[rhs];
    	arr[rhs] = tmp;
    	return;
    }
    
    public static void main(String [] args){
    	Scanner sc = new Scanner(System.in);
    	int w = sc.nextInt();
    	int n = sc.nextInt();

    	int[] lines = new int[w];
    	for(int i=0; i<lines.length;++i){
    	    lines[i] = i + 1;
    	}
	sc.nextLine();
    	for(int i=0; i<n;++i){
	    String line = sc.nextLine();
	    String[] ints = line.split(",");
	    // System.out.println(line);
	    int a = Integer.parseInt(ints[0]);
	    int b = Integer.parseInt(ints[1]);
	    swapidx(lines, a - 1, b - 1);
    	}
	for(int i=0; i<lines.length;++i){
	    System.out.println(lines[i]);
	}
    }

} Main
import java.io.IOException;
import java.util.Scanner;

public class Main  {

    static void swapidx(int[] arr, int lhs, int rhs){
    	int tmp = arr[lhs];
    	arr[lhs] = arr[rhs];
    	arr[rhs] = tmp;
    	return;
    }
    
    public static void main(String [] args){
    	Scanner sc = new Scanner(System.in);
    	int w = sc.nextInt();
    	int n = sc.nextInt();

    	int[] lines = new int[w];
    	for(int i=0; i<lines.length;++i){
    	    lines[i] = i + 1;
    	}
	sc.nextLine();
    	for(int i=0; i<n;++i){
	    String line = sc.nextLine();
	    String[] ints = line.split(",");
	    // System.out.println(line);
	    int a = Integer.parseInt(ints[0]);
	    int b = Integer.parseInt(ints[1]);
	    swapidx(lines, a - 1, b - 1);
    	}
	for(int i=0; i<lines.length;++i){
	    System.out.println(lines[i]);
	}
    }

}