#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;
int main(void)
{
	int w, n;
	cin >> w;
	cin >> n;
	vector<int> l(w);
	rep(i, w)
	{
		l[i] = i+1;
	}
	
	rep(i, n)
	{
	    int a, b;
	    cin >> a;
	    cin.ignore();
	    cin >> b;
	    swap(l[a-1], l[b-1]);
	}
	
	rep(i, w)
	{
	    cout << l[i] << endl;
	}
}
