import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
	try{
	    BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
	    int[] x = new int[Integer.valueOf(sc.readLine())];
	    int p, a, b, t = Integer.valueOf(sc.readLine());
	    String st, u, v;
	    for(int i=0; i<x.length; i++)
		x[i]=i+1;
	    for(int i=0; i<t; i++){
		String[] parts = sc.readLine().split(",");
		a = Integer.valueOf(parts[0]);
		b = Integer.valueOf(parts[1]);
		p=x[a-1];
		x[a-1]=x[b-1];
		x[b-1]=p;
	    }
	    for(int i=0; i<x.length; i++)
		System.out.println(x[i]);
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
} import java.io.*; io.* java import java.util.*; util.* java class Main{
    public static void main(String[] args){
	try{
	    BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
	    int[] x = new int[Integer.valueOf(sc.readLine())];
	    int p, a, b, t = Integer.valueOf(sc.readLine());
	    String st, u, v;
	    for(int i=0; i<x.length; i++)
		x[i]=i+1;
	    for(int i=0; i<t; i++){
		String[] parts = sc.readLine().split(",");
		a = Integer.valueOf(parts[0]);
		b = Integer.valueOf(parts[1]);
		p=x[a-1];
		x[a-1]=x[b-1];
		x[b-1]=p;
	    }
	    for(int i=0; i<x.length; i++)
		System.out.println(x[i]);
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
} Main public static void main(String[] args){
	try{
	    BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
	    int[] x = new int[Integer.valueOf(sc.readLine())];
	    int p, a, b, t = Integer.valueOf(sc.readLine());
	    String st, u, v;
	    for(int i=0; i<x.length; i++)
		x[i]=i+1;
	    for(int i=0; i<t; i++){
		String[] parts = sc.readLine().split(",");
		a = Integer.valueOf(parts[0]);
		b = Integer.valueOf(parts[1]);
		p=x[a-1];
		x[a-1]=x[b-1];
		x[b-1]=p;
	    }
	    for(int i=0; i<x.length; i++)
		System.out.println(x[i]);
	}catch(Exception e){
	    System.out.println("Error");
	}
    } main {
	try{
	    BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
	    int[] x = new int[Integer.valueOf(sc.readLine())];
	    int p, a, b, t = Integer.valueOf(sc.readLine());
	    String st, u, v;
	    for(int i=0; i<x.length; i++)
		x[i]=i+1;
	    for(int i=0; i<t; i++){
		String[] parts = sc.readLine().split(",");
		a = Integer.valueOf(parts[0]);
		b = Integer.valueOf(parts[1]);
		p=x[a-1];
		x[a-1]=x[b-1];
		x[b-1]=p;
	    }
	    for(int i=0; i<x.length; i++)
		System.out.println(x[i]);
	}catch(Exception e){
	    System.out.println("Error");
	}
    } try{
	    BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
	    int[] x = new int[Integer.valueOf(sc.readLine())];
	    int p, a, b, t = Integer.valueOf(sc.readLine());
	    String st, u, v;
	    for(int i=0; i<x.length; i++)
		x[i]=i+1;
	    for(int i=0; i<t; i++){
		String[] parts = sc.readLine().split(",");
		a = Integer.valueOf(parts[0]);
		b = Integer.valueOf(parts[1]);
		p=x[a-1];
		x[a-1]=x[b-1];
		x[b-1]=p;
	    }
	    for(int i=0; i<x.length; i++)
		System.out.println(x[i]);
	}catch(Exception e){
	    System.out.println("Error");
	} catch(Exception e){
	    System.out.println("Error");
	} Exception e {
	    System.out.println("Error");
	} System.out.println("Error") System.out.println System.out System System.out "Error" {
	    BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
	    int[] x = new int[Integer.valueOf(sc.readLine())];
	    int p, a, b, t = Integer.valueOf(sc.readLine());
	    String st, u, v;
	    for(int i=0; i<x.length; i++)
		x[i]=i+1;
	    for(int i=0; i<t; i++){
		String[] parts = sc.readLine().split(",");
		a = Integer.valueOf(parts[0]);
		b = Integer.valueOf(parts[1]);
		p=x[a-1];
		x[a-1]=x[b-1];
		x[b-1]=p;
	    }
	    for(int i=0; i<x.length; i++)
		System.out.println(x[i]);
	} BufferedReader sc = new BufferedReader(new InputStreamReader(System.in)); sc new BufferedReader(new InputStreamReader(System.in)) int[] x = new int[Integer.valueOf(sc.readLine())]; x new int[Integer.valueOf(sc.readLine())] Integer.valueOf(sc.readLine()) Integer.valueOf Integer sc.readLine() sc.readLine sc int p p a a b b t = Integer.valueOf(sc.readLine()); t Integer.valueOf(sc.readLine()) Integer.valueOf Integer sc.readLine() sc.readLine sc String st st u u v; v for(int i=0; i<x.length; i++)
		x[i]=i+1; int i=0; int i=0; i 0 i<x.length i x.length x x.length i++ i++ i x[i]=i+1; x[i]=i+1 x[i] x i i+1 i 1 for(int i=0; i<t; i++){
		String[] parts = sc.readLine().split(",");
		a = Integer.valueOf(parts[0]);
		b = Integer.valueOf(parts[1]);
		p=x[a-1];
		x[a-1]=x[b-1];
		x[b-1]=p;
	    } int i=0; int i=0; i 0 i<t i t i++ i++ i {
		String[] parts = sc.readLine().split(",");
		a = Integer.valueOf(parts[0]);
		b = Integer.valueOf(parts[1]);
		p=x[a-1];
		x[a-1]=x[b-1];
		x[b-1]=p;
	    } {
		String[] parts = sc.readLine().split(",");
		a = Integer.valueOf(parts[0]);
		b = Integer.valueOf(parts[1]);
		p=x[a-1];
		x[a-1]=x[b-1];
		x[b-1]=p;
	    } String[] parts = sc.readLine().split(","); parts sc.readLine().split(",") sc.readLine().split sc.readLine() sc.readLine sc "," a = Integer.valueOf(parts[0]) a Integer.valueOf(parts[0]) Integer.valueOf Integer parts[0] parts 0 b = Integer.valueOf(parts[1]) b Integer.valueOf(parts[1]) Integer.valueOf Integer parts[1] parts 1 p=x[a-1] p x[a-1] x a-1 a 1 x[a-1]=x[b-1] x[a-1] x a-1 a 1 x[b-1] x b-1 b 1 x[b-1]=p x[b-1] x b-1 b 1 p for(int i=0; i<x.length; i++)
		System.out.println(x[i]); int i=0; int i=0; i 0 i<x.length i x.length x x.length i++ i++ i System.out.println(x[i]); System.out.println(x[i]) System.out.println System.out System System.out x[i] x i String[] args args
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
	try{
	    BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
	    int[] x = new int[Integer.valueOf(sc.readLine())];
	    int p, a, b, t = Integer.valueOf(sc.readLine());
	    String st, u, v;
	    for(int i=0; i<x.length; i++)
		x[i]=i+1;
	    for(int i=0; i<t; i++){
		String[] parts = sc.readLine().split(",");
		a = Integer.valueOf(parts[0]);
		b = Integer.valueOf(parts[1]);
		p=x[a-1];
		x[a-1]=x[b-1];
		x[b-1]=p;
	    }
	    for(int i=0; i<x.length; i++)
		System.out.println(x[i]);
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
}