import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		boolean first=true;
        String str="";
        int i=0,length=0;
        int[] amida = null;

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            }
            for(int k=0;k<amida.length;k++){
            	System.out.println(amida[k]+1);
            }
		}
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		boolean first=true;
        String str="";
        int i=0,length=0;
        int[] amida = null;

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            }
            for(int k=0;k<amida.length;k++){
            	System.out.println(amida[k]+1);
            }
		}
	}

} Main public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		boolean first=true;
        String str="";
        int i=0,length=0;
        int[] amida = null;

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            }
            for(int k=0;k<amida.length;k++){
            	System.out.println(amida[k]+1);
            }
		}
	} main {
		// TODO ?????????????????????????????????????????????
		boolean first=true;
        String str="";
        int i=0,length=0;
        int[] amida = null;

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            }
            for(int k=0;k<amida.length;k++){
            	System.out.println(amida[k]+1);
            }
		}
	} boolean first=true; first true String str=""; str "" int i=0 i 0 length=0; length 0 int[] amida = null; amida null try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            }
            for(int k=0;k<amida.length;k++){
            	System.out.println(amida[k]+1);
            }
		} {
            String line;
            while ((line = br.readLine()) != null) {
            	if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            }
            for(int k=0;k<amida.length;k++){
            	System.out.println(amida[k]+1);
            }
		} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) String line; line while ((line = br.readLine()) != null) {
            	if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            } (line = br.readLine()) != null (line = br.readLine()) line br.readLine() br.readLine br null {
            	if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            } if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	} first {
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	} amida=new int[Integer.parseInt(line)] amida new int[Integer.parseInt(line)] Integer.parseInt(line) Integer.parseInt Integer line for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		} int j=0; int j=0; j 0 j<amida.length j amida.length amida amida.length j++ j++ j {
            			amida[j]=j;
            		} {
            			amida[j]=j;
            		} amida[j]=j amida[j] amida j j line = br.readLine() line br.readLine() br.readLine br length =Integer.parseInt(line) length Integer.parseInt(line) Integer.parseInt Integer line first=false first false {
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	} String[] tokens=line.split(","); tokens line.split(",") line.split line "," int store=amida[Integer.parseInt(tokens[0])-1]; store amida[Integer.parseInt(tokens[0])-1] amida Integer.parseInt(tokens[0])-1 Integer.parseInt(tokens[0]) Integer.parseInt Integer tokens[0] tokens 0 1 amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1] amida[Integer.parseInt(tokens[0])-1] amida Integer.parseInt(tokens[0])-1 Integer.parseInt(tokens[0]) Integer.parseInt Integer tokens[0] tokens 0 1 amida[Integer.parseInt(tokens[1])-1] amida Integer.parseInt(tokens[1])-1 Integer.parseInt(tokens[1]) Integer.parseInt Integer tokens[1] tokens 1 1 amida[Integer.parseInt(tokens[1])-1]=store amida[Integer.parseInt(tokens[1])-1] amida Integer.parseInt(tokens[1])-1 Integer.parseInt(tokens[1]) Integer.parseInt Integer tokens[1] tokens 1 1 store i++ i if(i==length){
            			break;
            		} i==length i length {
            			break;
            		} break; for(int k=0;k<amida.length;k++){
            	System.out.println(amida[k]+1);
            } int k=0; int k=0; k 0 k<amida.length k amida.length amida amida.length k++ k++ k {
            	System.out.println(amida[k]+1);
            } {
            	System.out.println(amida[k]+1);
            } System.out.println(amida[k]+1) System.out.println System.out System System.out amida[k]+1 amida[k] amida k 1 String[] args args public class Main{

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		boolean first=true;
        String str="";
        int i=0,length=0;
        int[] amida = null;

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            }
            for(int k=0;k<amida.length;k++){
            	System.out.println(amida[k]+1);
            }
		}
	}

} public class Main{

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		boolean first=true;
        String str="";
        int i=0,length=0;
        int[] amida = null;

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            }
            for(int k=0;k<amida.length;k++){
            	System.out.println(amida[k]+1);
            }
		}
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		boolean first=true;
        String str="";
        int i=0,length=0;
        int[] amida = null;

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	if(first){
            		amida=new int[Integer.parseInt(line)];
            		for(int j=0;j<amida.length;j++){
            			amida[j]=j;
            		}
            		line = br.readLine();
            		length =Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] tokens=line.split(",");
            		int store=amida[Integer.parseInt(tokens[0])-1];
            		amida[Integer.parseInt(tokens[0])-1]=amida[Integer.parseInt(tokens[1])-1];
            		amida[Integer.parseInt(tokens[1])-1]=store;
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            }
            for(int k=0;k<amida.length;k++){
            	System.out.println(amida[k]+1);
            }
		}
	}

}