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

int main() {

    int w, n;
    cin >> w >> n;

    vector<int> member(w);
    for (int m = 0; m < w; m++) {
        member[m] = m;
    }

    for (int t = 0; t < n; t++) {
        int a, b;
        char sep;
        cin >> a >> sep >> b;

        int tmp = member[b-1];
        member[b-1] = member[a-1];
        member[a-1] = tmp;
    }

    for (int m = 0; m < w; m++) {
        cout << member[m]  + 1 << endl;
    }
     
    return 0;
}