#include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

using namespace std;

vector<int>a;
vector<int>b;
vector<int>c;

int main(){

	int w,n,r,s; char p;

	cin >> w >> n;

	rep(i,n){
	cin >> r;
	a.push_back(r);

    cin >> p;

    cin >> s;
	b.push_back(s);


	}
	rep(i,w)
	c.push_back(i+1);

	rep(i,n)
	iter_swap(c.begin()+a[i]-1,c.begin()+b[i]-1);

	rep(i,w)
	cout << c[i] << endl;



	return 0;
}