#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>

using namespace std;

int w, n;
int ans[30];
int main()
{
    cin >> w >> n;
    REP(i, w) {
        ans[i] =i + 1;
    }
    REP(i, n) {
        char c;
        int a, b;
        cin >> a >> c >> b;
        a--;b--;
        int tmp = ans[a];
        ans[a] = ans[b];
        ans[b] = tmp;
    }
    REP(i, w) {
        cout << ans[i] << endl;
    }
}

