import java.util.Scanner;

class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	
    	while (scan.hasNextInt()){
    		int numverline = scan.nextInt();
    		int[] verline = new int[numverline];
    		for(int i = 0; i < numverline; i++){
    			verline[i] = i+1;
    		}
    		int horline = scan.nextInt();
    		int[][] coor = new int[horline][2];
    		for(int i = 0; i < horline; i++){
    			String[] tmp = scan.next().split(",");
    			coor[i][0] = Integer.parseInt(tmp[0]);
    			coor[i][1] = Integer.parseInt(tmp[1]);
    		}
    		
    		for(int i = 0; i < coor.length; i++){
    			int tmp = verline[coor[i][0]-1];
    			verline[coor[i][0]-1] = verline[coor[i][1]-1];
    			verline[coor[i][1]-1] = tmp;
    		}
    		
    		for(int i = 0; i < verline.length; i++){
    			System.out.println(verline[i]);
    		}
    	}
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	
    	while (scan.hasNextInt()){
    		int numverline = scan.nextInt();
    		int[] verline = new int[numverline];
    		for(int i = 0; i < numverline; i++){
    			verline[i] = i+1;
    		}
    		int horline = scan.nextInt();
    		int[][] coor = new int[horline][2];
    		for(int i = 0; i < horline; i++){
    			String[] tmp = scan.next().split(",");
    			coor[i][0] = Integer.parseInt(tmp[0]);
    			coor[i][1] = Integer.parseInt(tmp[1]);
    		}
    		
    		for(int i = 0; i < coor.length; i++){
    			int tmp = verline[coor[i][0]-1];
    			verline[coor[i][0]-1] = verline[coor[i][1]-1];
    			verline[coor[i][1]-1] = tmp;
    		}
    		
    		for(int i = 0; i < verline.length; i++){
    			System.out.println(verline[i]);
    		}
    	}
    }
} Main public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	
    	while (scan.hasNextInt()){
    		int numverline = scan.nextInt();
    		int[] verline = new int[numverline];
    		for(int i = 0; i < numverline; i++){
    			verline[i] = i+1;
    		}
    		int horline = scan.nextInt();
    		int[][] coor = new int[horline][2];
    		for(int i = 0; i < horline; i++){
    			String[] tmp = scan.next().split(",");
    			coor[i][0] = Integer.parseInt(tmp[0]);
    			coor[i][1] = Integer.parseInt(tmp[1]);
    		}
    		
    		for(int i = 0; i < coor.length; i++){
    			int tmp = verline[coor[i][0]-1];
    			verline[coor[i][0]-1] = verline[coor[i][1]-1];
    			verline[coor[i][1]-1] = tmp;
    		}
    		
    		for(int i = 0; i < verline.length; i++){
    			System.out.println(verline[i]);
    		}
    	}
    } main {
    	Scanner scan = new Scanner(System.in);
    	
    	while (scan.hasNextInt()){
    		int numverline = scan.nextInt();
    		int[] verline = new int[numverline];
    		for(int i = 0; i < numverline; i++){
    			verline[i] = i+1;
    		}
    		int horline = scan.nextInt();
    		int[][] coor = new int[horline][2];
    		for(int i = 0; i < horline; i++){
    			String[] tmp = scan.next().split(",");
    			coor[i][0] = Integer.parseInt(tmp[0]);
    			coor[i][1] = Integer.parseInt(tmp[1]);
    		}
    		
    		for(int i = 0; i < coor.length; i++){
    			int tmp = verline[coor[i][0]-1];
    			verline[coor[i][0]-1] = verline[coor[i][1]-1];
    			verline[coor[i][1]-1] = tmp;
    		}
    		
    		for(int i = 0; i < verline.length; i++){
    			System.out.println(verline[i]);
    		}
    	}
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) while (scan.hasNextInt()){
    		int numverline = scan.nextInt();
    		int[] verline = new int[numverline];
    		for(int i = 0; i < numverline; i++){
    			verline[i] = i+1;
    		}
    		int horline = scan.nextInt();
    		int[][] coor = new int[horline][2];
    		for(int i = 0; i < horline; i++){
    			String[] tmp = scan.next().split(",");
    			coor[i][0] = Integer.parseInt(tmp[0]);
    			coor[i][1] = Integer.parseInt(tmp[1]);
    		}
    		
    		for(int i = 0; i < coor.length; i++){
    			int tmp = verline[coor[i][0]-1];
    			verline[coor[i][0]-1] = verline[coor[i][1]-1];
    			verline[coor[i][1]-1] = tmp;
    		}
    		
    		for(int i = 0; i < verline.length; i++){
    			System.out.println(verline[i]);
    		}
    	} scan.hasNextInt() scan.hasNextInt scan {
    		int numverline = scan.nextInt();
    		int[] verline = new int[numverline];
    		for(int i = 0; i < numverline; i++){
    			verline[i] = i+1;
    		}
    		int horline = scan.nextInt();
    		int[][] coor = new int[horline][2];
    		for(int i = 0; i < horline; i++){
    			String[] tmp = scan.next().split(",");
    			coor[i][0] = Integer.parseInt(tmp[0]);
    			coor[i][1] = Integer.parseInt(tmp[1]);
    		}
    		
    		for(int i = 0; i < coor.length; i++){
    			int tmp = verline[coor[i][0]-1];
    			verline[coor[i][0]-1] = verline[coor[i][1]-1];
    			verline[coor[i][1]-1] = tmp;
    		}
    		
    		for(int i = 0; i < verline.length; i++){
    			System.out.println(verline[i]);
    		}
    	} int numverline = scan.nextInt(); numverline scan.nextInt() scan.nextInt scan int[] verline = new int[numverline]; verline new int[numverline] numverline for(int i = 0; i < numverline; i++){
    			verline[i] = i+1;
    		} int i = 0; int i = 0; i 0 i < numverline i numverline i++ i++ i {
    			verline[i] = i+1;
    		} {
    			verline[i] = i+1;
    		} verline[i] = i+1 verline[i] verline i i+1 i 1 int horline = scan.nextInt(); horline scan.nextInt() scan.nextInt scan int[][] coor = new int[horline][2]; coor new int[horline][2] horline 2 for(int i = 0; i < horline; i++){
    			String[] tmp = scan.next().split(",");
    			coor[i][0] = Integer.parseInt(tmp[0]);
    			coor[i][1] = Integer.parseInt(tmp[1]);
    		} int i = 0; int i = 0; i 0 i < horline i horline i++ i++ i {
    			String[] tmp = scan.next().split(",");
    			coor[i][0] = Integer.parseInt(tmp[0]);
    			coor[i][1] = Integer.parseInt(tmp[1]);
    		} {
    			String[] tmp = scan.next().split(",");
    			coor[i][0] = Integer.parseInt(tmp[0]);
    			coor[i][1] = Integer.parseInt(tmp[1]);
    		} String[] tmp = scan.next().split(","); tmp scan.next().split(",") scan.next().split scan.next() scan.next scan "," coor[i][0] = Integer.parseInt(tmp[0]) coor[i][0] coor[i] coor i 0 Integer.parseInt(tmp[0]) Integer.parseInt Integer tmp[0] tmp 0 coor[i][1] = Integer.parseInt(tmp[1]) coor[i][1] coor[i] coor i 1 Integer.parseInt(tmp[1]) Integer.parseInt Integer tmp[1] tmp 1 for(int i = 0; i < coor.length; i++){
    			int tmp = verline[coor[i][0]-1];
    			verline[coor[i][0]-1] = verline[coor[i][1]-1];
    			verline[coor[i][1]-1] = tmp;
    		} int i = 0; int i = 0; i 0 i < coor.length i coor.length coor coor.length i++ i++ i {
    			int tmp = verline[coor[i][0]-1];
    			verline[coor[i][0]-1] = verline[coor[i][1]-1];
    			verline[coor[i][1]-1] = tmp;
    		} {
    			int tmp = verline[coor[i][0]-1];
    			verline[coor[i][0]-1] = verline[coor[i][1]-1];
    			verline[coor[i][1]-1] = tmp;
    		} int tmp = verline[coor[i][0]-1]; tmp verline[coor[i][0]-1] verline coor[i][0]-1 coor[i][0] coor[i] coor i 0 1 verline[coor[i][0]-1] = verline[coor[i][1]-1] verline[coor[i][0]-1] verline coor[i][0]-1 coor[i][0] coor[i] coor i 0 1 verline[coor[i][1]-1] verline coor[i][1]-1 coor[i][1] coor[i] coor i 1 1 verline[coor[i][1]-1] = tmp verline[coor[i][1]-1] verline coor[i][1]-1 coor[i][1] coor[i] coor i 1 1 tmp for(int i = 0; i < verline.length; i++){
    			System.out.println(verline[i]);
    		} int i = 0; int i = 0; i 0 i < verline.length i verline.length verline verline.length i++ i++ i {
    			System.out.println(verline[i]);
    		} {
    			System.out.println(verline[i]);
    		} System.out.println(verline[i]) System.out.println System.out System System.out verline[i] verline i String[] args args
import java.util.Scanner;

class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	
    	while (scan.hasNextInt()){
    		int numverline = scan.nextInt();
    		int[] verline = new int[numverline];
    		for(int i = 0; i < numverline; i++){
    			verline[i] = i+1;
    		}
    		int horline = scan.nextInt();
    		int[][] coor = new int[horline][2];
    		for(int i = 0; i < horline; i++){
    			String[] tmp = scan.next().split(",");
    			coor[i][0] = Integer.parseInt(tmp[0]);
    			coor[i][1] = Integer.parseInt(tmp[1]);
    		}
    		
    		for(int i = 0; i < coor.length; i++){
    			int tmp = verline[coor[i][0]-1];
    			verline[coor[i][0]-1] = verline[coor[i][1]-1];
    			verline[coor[i][1]-1] = tmp;
    		}
    		
    		for(int i = 0; i < verline.length; i++){
    			System.out.println(verline[i]);
    		}
    	}
    }
}