#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
    int w, n, a, b, t;
	char c;
	cin >> w >> n;
	
	vector<int> tate;
	
	for(int i=1;i<=w;i++){
		tate.push_back(i);
	}
	
	for(int i=0;i<n;i++){
		cin >> a >> c >> b;
		t = tate[a-1];
		tate[a-1]=tate[b-1];
		tate[b-1]=t;
	}
	
	for(int i=0;i<w;i++){
		cout << tate[i] << endl;
	}
	
	return 0;
}