Another query?...
All participants are very tired of query tasks, every contest should have at least one such task. Here it is...
You are given an array of integers . You need to process the following queries:
— assign each element on the segment the value , where is the bitwise
AND
operator.— output the maximum value of over all pairs such that . If such a pair does not exist, output .
The input will only contain queries of the first type. Assume that after each query of the first type there is a query of the second type. Also, before the first query of the first type, output the answer to the first query of the second type.
Here, denotes the greatest common divisor of and . For example, and .
Input
The first line contains two integers () and () — the number of elements in the array and the number of queries of the first type.
The next line contains integers () — the array elements.
The next lines contain three integers each: , and — a description of the query.
Output
Output lines — the answers to the queries of the second type.
Examples
Note
Explanation for the first example:
Before performing any operations, we have the array , and the maximum is .
After the first operation, we have the array , and the maximum is .
After the second operation, we have the array , and the maximum is .
Scoring
Solutions passing all test cases with will be awarded at least points.
Solutions passing all test cases with will be awarded at least points.