Descent of Dragons
题号:NC223857
时间限制:C/C++/Rust/Pascal 5秒,其他语言10秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 M
64bit IO Format: %lld

题目描述

Hey, look, what's that? It's dragons in dragons' descent!
There are dragons in a row, indexed 1 through . Every dragon has a level, and initially, every dragon is of level 0.

You are a hero of the league of explorers. And your task is to counter the attack of the league of evil.
You are training the dragons in peacetime. When the villains launched a battle, you have to select the best dragon to defend.

Specifically, you have to process events in order. Each event has one of the following types.

Training Given , for all dragons of level with indices between to inclusive, increase their levels to ;
Defense Given , find the maximum level of dragons with indices between to inclusive.

输入描述:

The first line contains two integers  , representing the length of the sequence and the number of queries.
The next lines contain the queries in order, one per line. Each line may either contain four integers , denoting a training event; or three integers , denoting a defense event. It is guaranteed that there is at least one defense event in the input.

输出描述:

For each defense event, print the result in a line.
示例1

输入

复制
5 5
1 3 5 0
1 1 4 1
1 1 5 2
2 2 2
2 4 5

输出

复制
0
3