#include <stdio.h>
int main(){
    int n, m, x, y, t;
    scanf("%d %d",&n, &m);

    int arr[100];
    for(int i=0; i<n; i++) arr[i] = i+1;

    while(m--){
        scanf("%d %d",&x, &y);
        t = arr[x-1];
        arr[x-1] = arr[y-1];
        arr[y-1] = t;
    }

    for(int j=0; j<n; j++){
        printf("%d ",arr[j]);
    }

    return 0;

}