import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;

public class Main
{
	public static void main(String[] arg) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int v = Integer.valueOf(br.readLine());
		ArrayList<Integer> amida = new ArrayList<Integer>(v);
		for(int i=0; i<v; i++)
			amida.add(i+1);

		int h = Integer.valueOf(br.readLine());
		
		for(int i=0; i<h; i++){
			String swapInd = br.readLine();
			int swap1 = Integer.valueOf(swapInd.split(",")[0]);
			int swap2 = Integer.valueOf(swapInd.split(",")[1]);
			Collections.swap(amida,swap1-1,swap2-1);
		}

		for(int i=0; i<v; i++)
			System.out.println(amida.get(i));
	}
}
/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