
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;
typedef vector<int> VI;
#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int vertical;
    int horizon;
    
    cin >> vertical;
    cin >> horizon;
    
    vector<int> numbers;
    REP(i, 0, vertical) {
        numbers.push_back(i+1);
    }
    
    REP(i, 0, horizon) {
        int sa, sb;
        char comm;
        cin >> sa >> comm >> sb;
        swap(numbers[sa-1], numbers[sb-1]);
    }

    REP(i, 0, vertical) {
        cout << numbers.at(i) << endl;
    }

    return 0;
}