#include <cstdio>
#include <iostream>
#include <map>
#include <vector>
#define P pair<int, int>
using namespace std;

int main()
{	
	int w, n;
	cin >> w >> n;
	vector<int> v(w);
	for (int i = 1; i <= w; i++)
		v[i - 1] = i;
	P p;
	int t;
	for (int i = 0; i < n; i++) {
		scanf("%d,%d", &p.first, &p.second);
		t = v[p.first - 1];
		v[p.first - 1] = v[p.second - 1];
		v[p.second - 1] = t;
	}
	
	for (int i = 0; i < w; i++)
		cout << v[i] << endl;
	
		
	return 0;
}