After several holiday seasons,
's old Christmas lights aren't looking too good. Some of the bulbs still glow normally, but others are almost completely out. wants to reuse them again next year, but doesn't want his decorations to look too shabby either.If
considers the string of lights fromto to be pretty, which contiguous segment of lights should he keep from such that the segment is consistent and has the maximum length possible?
Help
keep his decorations beautiful for another year!Constraints
Subtask 1 [20%]
Subtask 2 [80%]
Input Specification
The first line of input will contain
The second line will contain
The third line will contain
The next l r
.
Output Specification
Output the answer to each query on a separate line. Each answer should be of the form a b
Sample Input
7 4
3 6 8 4 3 6 1
3
2 6
3 6
1 3
Sample Output
2 4
4 6
1 2
Explanation for Sample Output
Note that in the first query, both 2 4
and 4 6
have the same length, but we output the smallest possible answers. Similarly, in the third query, 2 3
is the same length but not outputted.
Comments