G. Dhaka
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output
Tuk-tuks performing radical maneuvers.

In the busy streets of Dhaka, the capital of Bangladesh, it is common to see small vehicles called tuk-tuks. These three-wheeled vehicles are a popular and agile form of urban transport, widely used by both locals and tourists. It was in this city that the world marathon final took place in November 2022.

Every year, Dhaka hosts a traditional tuk-tuk race that attracts the attention of the entire city. Unlike conventional races with laps and turns, this competition is quite chaotic and fun: at any moment, any tuk-tuk can perform a daring maneuver, earning points that may improve its ranking position.

You have been called to work with the judging team of the competition and are responsible for tracking the positions of the tuk-tuks throughout the race, noting every time a tuk-tuk advances in position. Unfortunately, one of the assistants forgot to record the score values of the tuk-tuks — both the initial scores and the points earned for each maneuver.

Now that the race is over, newspapers are demanding the complete data, and you urgently need to reconstruct a possible sequence of scores compatible with the position records.

In this task, you will receive two integers $$$N$$$ and $$$Q$$$:

  • $$$N$$$ is the number of participating tuk-tuks. Initially, tuk-tuk $$$i$$$ is in position $$$i$$$ (with position $$$1$$$ being the best placement).
  • Next, you will receive $$$Q$$$ updates. Each update informs that tuk-tuk $$$P$$$ has moved to position $$$X$$$, which is better than or equal to its previous position.

Your task is:

  • To find a possible assignment of initial scores to the $$$N$$$ tuk-tuks;
  • For each update, report how many points tuk-tuk $$$P$$$ earned in the maneuver that led to its new position;

You must ensure that the ranking remains consistent after each maneuver — that is, the tuk-tuks must remain ordered by score after each update.

All score values (initial and earned) must be in the range $$$[0, 10^9]$$$. Additionally, the final scores must also be within this range. Finally, you must also ensure that at all times the scores are distinct (there are no ties).

Input

The first line contains two integers $$$N$$$ and $$$Q$$$ ($$$1 \leq N \leq 1000,\ 0 \leq Q \leq 10^{5}$$$) — the number of tuk-tuks and the number of observed updates.

The next $$$Q$$$ lines contain two integers $$$P_i$$$ and $$$X_i$$$, indicating that tuk-tuk $$$P_i$$$ has moved to position $$$X_i$$$. It is guaranteed that $$$1 \leq P_i, X_i \leq N$$$ and that $$$X_i$$$ is a position better than or equal to the position that $$$P_i$$$ was in before the maneuver was recorded.

Output

The first line must contain $$$N$$$ integers: the initial score of each tuk-tuk (from $$$1$$$ to $$$N$$$), separated by spaces.

Then, print $$$Q$$$ lines, each with an integer representing the number of points earned by the respective tuk-tuk in that maneuver.

All printed values must be between $$$0$$$ and $$$10^9$$$ (inclusive).

Examples
Input
3 2
2 1
3 2
Output
2 1 0
3
3
Input
5 5
5 1
4 1
3 1
2 1
1 1
Output
4 3 2 1 0
5
5
5
5
5