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);

for(let x=1; x<=m; x++){
    let [i, j] = inputs[x].split(" ").map(Number);
    for(let d=0; d<(j-i+1)/2; d++){
        let temp = arr[i-1+d];
        arr[i-1+d] = arr[j-1-d];
        arr[j-1-d] = temp;
    }
}
console.log(...arr);