Seeing how many people wanted to know their future CF rating, Stefan decided to actually use his programming skills to actually find some important points in people’s CF rating graphs. Since he doesn’t have time to add all his charting techniques in the code, he will only deal with points of interest.
Namely, he is given an array of integers, indexed from , and a continuous function, such that , which represents someone’s CodeForces rating graph, described as a function. Since the function is continuous, for each line between two consecutive points, the graph of the function touches all the integer points between the values.
For example, if and , the line will touch the integer points , , , , , and .
We are also given queries, where at some query we will change the value of a given position in the array and after each query, we must print the point of interest of this array, which is the point touched the biggest amount of times by the graph of the function; Furthermore, you also have to print how many times it is touched.
If there are multiple such points, we will print the point with the smallest value among them.
It is also guaranteed that the values will be distinct both at the beginning and throughout the updates.
Input
On the first line you will get , the number of integers from the array ().
On the second line you will get distinct integers, representing the array ().
On the third line you will get , the number of queries we have to answer to ().
On the next lines you will get two numbers, and , representing that becomes .
For tests worth points, ().
Output
The output will contain lines, each line containing the two integers asked by the problem, namely the leftmost point which is touched the most amount of times by the graph of the function and how many times it is touched after the first updates have been done.
Example
stdin
5
4 2 6 1 7
5
1 3
4 4
2 1
5 2
3 5
stdout
3 4
5 3
5 3
2 3
2 3
Explanation
After all the updates are done, the array will look like this: 3 1 5 4 2
.
The integer is touched times, between positions and , between positions and and between positions and .