#include <iostream>

int main()
{
    int w, n;
    std::cin >> w >> n;

    int state[30] = {};
    for (int i = 0; i < w; ++i) state[i] = i + 1;

    for (int i = 0; i < n; ++i) {
        int a, b;
        char comma;
        std::cin >> a >> comma >> b;
        int tmp = state[a - 1]; state[a - 1] = state[b - 1]; state[b - 1] = tmp;
    }

    for (int i = 0; i < w; ++i) std::cout << state[i] << std::endl;
}