#include<iostream>
#include<cstdio>
using namespace std;
int main(void){
    int w[30],a,b,tmp,d,n;
    char c;
    cin >> d >> n;
    for(int i=0; i<d; i++)
        w[i] = i+1;
    for(int i=0; i<n; i++){
        cin >> a >> c >> b;
        tmp = w[a-1]; w[a-1] = w[b-1]; w[b-1] = tmp;
    }
    for(int i=0; i<d; i++)
        cout << w[i] << endl;
}
