#include <stdio.h>

int main()
{
    int w, n, a, b, t, s[30];

    scanf("%d %d", &w, &n);
    for (int i = 0; i < w; i++)
        s[i] = i + 1;

    for (int i = 0; i < n; i++)
    {
        scanf("%d,%d", &a, &b);
        t = s[a - 1];
        s[a - 1] = s[b - 1];
        s[b - 1] = t;
    }

    for (int i = 0; i < w; i++)
        printf("%d\n", s[i]);

    return 0;
}

