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

int main() {
	int i,n,w,a1,a2,temp;
	char ch;
	
	cin >>w >>n;

	vector<int> amida;
	
	for(i=0;i<w;i++)
		amida.push_back(i+1);
	
	for(i=0;i<n;i++){
		cin >> a1;
		cin >> ch;
		cin >> a2;
		
		temp = amida[a1-1];
		amida[a1-1] = amida[a2-1];
		amida[a2-1] = temp;
		
	}
	
	for(i=0;i<w;i++){
		cout << amida[i] <<endl;
	}	
			
	return 0;
  
}