- Time limit: 1.00 s
- Memory limit: 512 MB
There are buildings on a street, numbered . Each building has a pizzeria and an apartment.
The pizza price in building is . If you order a pizza from building to building , its price (with delivery) is .
Your task is to process two types of queries:
- The pizza price in building becomes .
- You are in building and want to order a pizza. What is the minimum price?
Input
The first input line has two integers and : the number of buildings and queries.
The second line has integers : the initial pizza price in each building.
Finally, there are lines that describe the queries. Each line is either "1 " or "2 ".
Output
Print the answer for each query of type 2.
Constraints
Example
Input:
6 3 8 6 4 5 7 5 2 2 1 5 1 2 2
Output:
5 4