Game of Sorting

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Alice and Bob have invented a new game to play. First, they get a sequence. And then they take turns to make the following moves. During each move, the play will choose either the first element of the sequence or the last element, and remove the chosen element. The player who makes the sequence nondecreasing or nonincreasing wins. If the initial sequence is a nondecreasing or nonincreasing sequence, Bob wins the game.

The winter vacation is boring, so the kids want to play this game many times. Initially, they have a sequence of length nn: a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n. Alice realized that if they start the game after removing some of the first elements of the sequence and some of its last elements, you can get completely different results.

Alice and Bob played the game QQ times in total. The question is who will finally win each game if both players play optimally. Remember that Alice always moves first.

입력

The first line contains an integer nn, the length of the initial sequence (3n1063 \le n \le 10^6).

The second line contains nn space-separated integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n: the sequence itself (1a_i1091 \le a\_i \le 10^9).

The third line contains an integer QQ (1Q1061 \le Q \le 10^6).

The ii-th of the following QQ lines contains integers L_iL\_i and R_iR\_i (1L_iR_in1 \le L\_{i} \le R\_{i} \le n). It means that the initial sequence of ii-th game is a_L_i,a_L_i+1,,a_R_ia\_{L\_i}, a\_{L\_i + 1}, \ldots, a\_{R\_i}.

출력

Print QQ lines with the winner's name, one for each query.