To the beginning of the row!
To the beginning of the row!
Studip the officer likes to command his troops. His favorite order is "**to the beginning of the row**". He builds his units in a line and announce the sequence of orders. Each order is given in the form "Soldiers from li
to r [i]
- go to the beginning of the row!".
Number of soldiers in the initial position from 1 to n from left to right. The command “Soldiers from li
to ri
- to the beginning of the row!” means that soldiers standing at positions from li
to ri
inclusively are moved to the beginning of the row, keeping the relative order.
For example, if at some time the soldiers are in order 2, 3, 6, 1, 5, 4, then after the command “Soldiers from 2 to 4 - to the beginning of the row!” the order will be 3, 6, 1, 2, 5, 4.
By the given sequence of orders find the final order of soldiers in the row.
Input
The first line contains two integers n and m (2 ≤ n ≤ 100000, 1 ≤ m ≤ 100000) – the number of soldiers and the number of commands. Each of the next m lines contains two integers li
and ri
(1 ≤ li
≤ ri
≤ n).
Output
Print n integers - the order of soldiers in the final position after performance of all commands.
6 3 2 4 3 5 2 2
1 4 5 2 3 6