eolymp
bolt
Try our new interface for solving problems
Problems

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 (2n100000, 1m100000) – the number of soldiers and the number of commands. Each of the next m lines contains two integers li and ri (1lirin).

Output

Print n integers - the order of soldiers in the final position after performance of all commands.

Time limit 1 second
Memory limit 64 MiB
Input example #1
6 3
2 4
3 5
2 2
Output example #1
1 4 5 2 3 6
Author В.Гольдштейн
Source Зимние сборы в Харькове 2010 День 2