const inputs = require("fs").readFileSync(0, "utf8").toString().split("\n");
const [n, m] = inputs[0].split(" ").map(Number);
let arr = Array.from({length:n}, (_,i) => i+1);
let i,j,temp;
for(let t=1; t<=m; t++){
    [i,j] = inputs[t].split(" ");
    temp = arr[i-1];
    arr[i-1] = arr[j-1];
    arr[j-1] = temp;
}
console.log(...arr);