import std.stdio;
import std.range;
import std.array;
import std.algorithm;
import std.conv;
import std.string;



void main()
{
	int w, n;
	readf("%d\n %d\n",&w,&n);
	int[] num = new int[w];
	foreach(i; 0 .. w)
		num[i] = i + 1;
	int buff, a, b;
	foreach(i; 0 .. n)
	{
		readf("%d,%d\n",&a,&b);
		buff = num[a - 1];
		num[a - 1] = num[b - 1];
		num[b - 1] = buff;
	}
	foreach(k; 0 .. w)
		writeln(num[k]);
}