import java.util.Scanner;

public class Main
{
	private static void swap(int r[],int a,int b)
	{
		int tmp=r[a];
		r[a]=r[b];
		r[b]=tmp;
	}
	public static void main(String[] args)
	{
		Scanner scan=new Scanner(System.in);
		int w=scan.nextInt();
		int n=scan.nextInt();
		int a,b;
		int[] r=new int[w];
		for(int i=0;i<r.length;i++){
			r[i]=i+1;
		}
		for(int i=0;i<n;i++){
			String[] tmp=scan.next().split(",");
			a=Integer.parseInt(tmp[0]);
			b=Integer.parseInt(tmp[1]);
			swap(r,a-1,b-1);
		}
		for(int i=0;i<r.length;i++){
			System.out.println(r[i]);
		}
		scan.close();
	}
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz