Dohyun has N baskets, and the baskets carry the numbers 1 through N 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 Nth basket.
Dohyun is going to reverse the order of the baskets M 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 M reversals.
The first line contains N (1≤N≤100) and M (1≤M≤100).
Each of the next M lines contains one way of reversing the order of the baskets. A way is written as i j, which means reversing the order of the baskets from the ith basket to the jth basket counted from the left. (1≤i≤j≤N)
Dohyun performs the reversals in the order given in the input.
After all the reversals, print the number written on each basket, starting from the leftmost basket, separated by spaces on one line.