import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main{
    public static void main(String args[]){
	try{
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    String str;
	    String strary[] = new String[2];
	    int w = Integer.parseInt(br.readLine());
	    int n = Integer.parseInt(br.readLine());
	    int ary[] = new int[w];
	    for (int i = 0; i < w; i++) {
		ary[i] = i+1;
	    }
	    int a,b,tmp;
	    for (int i = 0; i < n; i++) {
		str = br.readLine();
		strary = str.split(",");
		a = Integer.parseInt(strary[0]);
		b = Integer.parseInt(strary[1]);
		tmp = ary[a-1];
		ary[a-1] = ary[b-1];
		ary[b-1] = tmp;
	    }
	    for (int i = 0; i < w; i++) {
		System.out.println(ary[i]);
	    }
	}
	catch(Exception e){
	    System.out.println("error");
	    System.exit(0);
	}
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io class Main{
    public static void main(String args[]){
	try{
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    String str;
	    String strary[] = new String[2];
	    int w = Integer.parseInt(br.readLine());
	    int n = Integer.parseInt(br.readLine());
	    int ary[] = new int[w];
	    for (int i = 0; i < w; i++) {
		ary[i] = i+1;
	    }
	    int a,b,tmp;
	    for (int i = 0; i < n; i++) {
		str = br.readLine();
		strary = str.split(",");
		a = Integer.parseInt(strary[0]);
		b = Integer.parseInt(strary[1]);
		tmp = ary[a-1];
		ary[a-1] = ary[b-1];
		ary[b-1] = tmp;
	    }
	    for (int i = 0; i < w; i++) {
		System.out.println(ary[i]);
	    }
	}
	catch(Exception e){
	    System.out.println("error");
	    System.exit(0);
	}
    }
} Main public static void main(String args[]){
	try{
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    String str;
	    String strary[] = new String[2];
	    int w = Integer.parseInt(br.readLine());
	    int n = Integer.parseInt(br.readLine());
	    int ary[] = new int[w];
	    for (int i = 0; i < w; i++) {
		ary[i] = i+1;
	    }
	    int a,b,tmp;
	    for (int i = 0; i < n; i++) {
		str = br.readLine();
		strary = str.split(",");
		a = Integer.parseInt(strary[0]);
		b = Integer.parseInt(strary[1]);
		tmp = ary[a-1];
		ary[a-1] = ary[b-1];
		ary[b-1] = tmp;
	    }
	    for (int i = 0; i < w; i++) {
		System.out.println(ary[i]);
	    }
	}
	catch(Exception e){
	    System.out.println("error");
	    System.exit(0);
	}
    } main {
	try{
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    String str;
	    String strary[] = new String[2];
	    int w = Integer.parseInt(br.readLine());
	    int n = Integer.parseInt(br.readLine());
	    int ary[] = new int[w];
	    for (int i = 0; i < w; i++) {
		ary[i] = i+1;
	    }
	    int a,b,tmp;
	    for (int i = 0; i < n; i++) {
		str = br.readLine();
		strary = str.split(",");
		a = Integer.parseInt(strary[0]);
		b = Integer.parseInt(strary[1]);
		tmp = ary[a-1];
		ary[a-1] = ary[b-1];
		ary[b-1] = tmp;
	    }
	    for (int i = 0; i < w; i++) {
		System.out.println(ary[i]);
	    }
	}
	catch(Exception e){
	    System.out.println("error");
	    System.exit(0);
	}
    } try{
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    String str;
	    String strary[] = new String[2];
	    int w = Integer.parseInt(br.readLine());
	    int n = Integer.parseInt(br.readLine());
	    int ary[] = new int[w];
	    for (int i = 0; i < w; i++) {
		ary[i] = i+1;
	    }
	    int a,b,tmp;
	    for (int i = 0; i < n; i++) {
		str = br.readLine();
		strary = str.split(",");
		a = Integer.parseInt(strary[0]);
		b = Integer.parseInt(strary[1]);
		tmp = ary[a-1];
		ary[a-1] = ary[b-1];
		ary[b-1] = tmp;
	    }
	    for (int i = 0; i < w; i++) {
		System.out.println(ary[i]);
	    }
	}
	catch(Exception e){
	    System.out.println("error");
	    System.exit(0);
	} catch(Exception e){
	    System.out.println("error");
	    System.exit(0);
	} Exception e {
	    System.out.println("error");
	    System.exit(0);
	} System.out.println("error") System.out.println System.out System System.out "error" System.exit(0) System.exit System 0 {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    String str;
	    String strary[] = new String[2];
	    int w = Integer.parseInt(br.readLine());
	    int n = Integer.parseInt(br.readLine());
	    int ary[] = new int[w];
	    for (int i = 0; i < w; i++) {
		ary[i] = i+1;
	    }
	    int a,b,tmp;
	    for (int i = 0; i < n; i++) {
		str = br.readLine();
		strary = str.split(",");
		a = Integer.parseInt(strary[0]);
		b = Integer.parseInt(strary[1]);
		tmp = ary[a-1];
		ary[a-1] = ary[b-1];
		ary[b-1] = tmp;
	    }
	    for (int i = 0; i < w; i++) {
		System.out.println(ary[i]);
	    }
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str; str String strary[] = new String[2]; strary new String[2] 2 int w = Integer.parseInt(br.readLine()); w Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int ary[] = new int[w]; ary new int[w] w for (int i = 0; i < w; i++) {
		ary[i] = i+1;
	    } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
		ary[i] = i+1;
	    } {
		ary[i] = i+1;
	    } ary[i] = i+1 ary[i] ary i i+1 i 1 int a a b b tmp; tmp for (int i = 0; i < n; i++) {
		str = br.readLine();
		strary = str.split(",");
		a = Integer.parseInt(strary[0]);
		b = Integer.parseInt(strary[1]);
		tmp = ary[a-1];
		ary[a-1] = ary[b-1];
		ary[b-1] = tmp;
	    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
		str = br.readLine();
		strary = str.split(",");
		a = Integer.parseInt(strary[0]);
		b = Integer.parseInt(strary[1]);
		tmp = ary[a-1];
		ary[a-1] = ary[b-1];
		ary[b-1] = tmp;
	    } {
		str = br.readLine();
		strary = str.split(",");
		a = Integer.parseInt(strary[0]);
		b = Integer.parseInt(strary[1]);
		tmp = ary[a-1];
		ary[a-1] = ary[b-1];
		ary[b-1] = tmp;
	    } str = br.readLine() str br.readLine() br.readLine br strary = str.split(",") strary str.split(",") str.split str "," a = Integer.parseInt(strary[0]) a Integer.parseInt(strary[0]) Integer.parseInt Integer strary[0] strary 0 b = Integer.parseInt(strary[1]) b Integer.parseInt(strary[1]) Integer.parseInt Integer strary[1] strary 1 tmp = ary[a-1] tmp ary[a-1] ary a-1 a 1 ary[a-1] = ary[b-1] ary[a-1] ary a-1 a 1 ary[b-1] ary b-1 b 1 ary[b-1] = tmp ary[b-1] ary b-1 b 1 tmp for (int i = 0; i < w; i++) {
		System.out.println(ary[i]);
	    } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
		System.out.println(ary[i]);
	    } {
		System.out.println(ary[i]);
	    } System.out.println(ary[i]) System.out.println System.out System System.out ary[i] ary i String args[] args
import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main{
    public static void main(String args[]){
	try{
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    String str;
	    String strary[] = new String[2];
	    int w = Integer.parseInt(br.readLine());
	    int n = Integer.parseInt(br.readLine());
	    int ary[] = new int[w];
	    for (int i = 0; i < w; i++) {
		ary[i] = i+1;
	    }
	    int a,b,tmp;
	    for (int i = 0; i < n; i++) {
		str = br.readLine();
		strary = str.split(",");
		a = Integer.parseInt(strary[0]);
		b = Integer.parseInt(strary[1]);
		tmp = ary[a-1];
		ary[a-1] = ary[b-1];
		ary[b-1] = tmp;
	    }
	    for (int i = 0; i < w; i++) {
		System.out.println(ary[i]);
	    }
	}
	catch(Exception e){
	    System.out.println("error");
	    System.exit(0);
	}
    }
}