#include "bits/stdc++.h"
using namespace std;

int main() {
	int W, N;
	vector<int> V;
	cin >> W >> N;
	for (int i = 1; i <= W; i++) {
		V.push_back(i);
	}
	for (int i = 0; i < N; i++) {
		int A, B;
		char C;
		cin >> A >> C >> B;
		A--, B--;
		swap(V[A], V[B]);
	}
	for (int i = 0; i < W; i++) {
		cout << V[i] << endl;
	}
}
