Winnie-the-Pooh 2#4488

Winnie-the-Pooh 2

2 seconds
128 megabytes
Easy

If you have read the previous problem, you know the story about Winnie-the-Pooh. In this problem, the scenario is similar, but now Winnie sometimes swaps a whole group of barrels at once. However, he can only swap barrels that are next to each other, to make bookkeeping easier. Furthermore, whenever Winnie swaps barrels, all new barrels come from the same batch, so their sweetness levels are identical. Your task is, once again, to determine the maximum possible number of barrels the bear can have for breakfast—for each query described below.

Input

The first line contains a single integer (1 \le N \le 10^6)—the number of barrels in Winnie-the-Pooh's cellar.

The second line contains integers—the sweetness levels of the barrels (each integer does not exceed 10^9).

The next line contains an integer (1 \le M \le 10^5)—the number of queries.

Each of the following lines describes a query.

  • The first number in a line specifies the query type.

    • If it is , the line is followed by two integers and (1 \le l \le r \le N). For this query, you must determine the answer as described below.

    • If it is , the line is followed by three integers , , and . This means that the sweetness of all barrels from to has changed to .

Output

For each query of type , output the maximum number of consecutive barrels in the segment [l; r] such that the sweetness level of each barrel, except the first one, is not less than the sweetness of the previous barrel.

Examples

Example 1

Loading
Loading