Winnie-the-Pooh 2
If you've read the previous problem, you're already familiar with the story of Winnie-the-Pooh. In this scenario, the same situation occurs, but now Winnie sometimes swaps an entire set of barrels at once. However, he can only swap barrels that are next to each other, making it easier to keep track. Additionally, when he swaps barrels, all the new ones come from the same batch, meaning their sweetness level is identical. Your task is to determine the maximum number of barrels the bear can have for breakfast.
Input
The first line contains a single integer N (1 ≤ N ≤ 10^6) — the number of barrels in Winnie-the-Pooh's cellar. The next line contains N integers representing the sweetness of each barrel (each number does not exceed 10^9). Following this, there is an integer M (1 ≤ M ≤ 10^5) — the number of queries. Each of the next M lines begins with a query type. If the query type is 1, it is followed by two integers, l and r (1 ≤ l ≤ r ≤ N), and you need to find the solution to the problem. If the query type is 2, it is followed by three integers l, r, v, indicating that the sweetness of the barrels from l to r has changed to v.
Output
For each query of type one, output the maximum number of consecutive barrels in the range [l; r] where the sweetness of each barrel, except the first, is not less than the sweetness of the previous one.