Reversing baskets

No attempts yetTime limit1sMemory limit256 MB

Problem

Dohyun has NN baskets, and the baskets carry the numbers 1 through NN written on them in order. The baskets stand in a single row. The leftmost basket is the 1st basket, the next one is the 2nd basket, ..., and the rightmost one is the NNth basket.

Dohyun is going to reverse the order of the baskets MM times. Each time, he picks a range and reverses the order of the baskets inside that range.

Given how Dohyun reverses the order, write a program that prints the numbers written on the baskets, starting from the leftmost basket, after all MM reversals.

Input

The first line contains NN (1N1001 \le N \le 100) and MM (1M1001 \le M \le 100).

Each of the next MM lines contains one way of reversing the order of the baskets. A way is written as ii jj, which means reversing the order of the baskets from the iith basket to the jjth basket counted from the left. (1ijN1 \le i \le j \le N)

Dohyun performs the reversals in the order given in the input.

Output

After all the reversals, print the number written on each basket, starting from the leftmost basket, separated by spaces on one line.