#include<iostream>
#include<vector>
using namespace std;

int main()
{
	int w,n;
	vector<int> list;

	cin >> w >> n;

	for(int i=0;i<w;++i)
		list.push_back(i);

	for(int i=0;i<n;++i){
		int a,b,tmp;
		char dummy;
		cin >> a >> dummy >> b;

		a--;
		b--;

		tmp		= list[a];
		list[a]	= list[b];
		list[b]	= tmp;

	}

	for(int i=0;i<w;++i){
		cout << list[i]+1 << endl;
	}

	return 0;
}