| OMORI CONTEST |
|---|
| Закончено |
Basil wants to play a game with his best friend Sunny; he starts by explaining the rules to him.
The game is played on an array of $$$n$$$ flower pots, where the $$$i$$$-th pot $$$(1 \le i \le n)$$$ has two values $$$a_i$$$, $$$t_i$$$, denoting the number of seeds initially in the $$$i$$$-th flower pot and the type of seeds in this flower pot, respectively.
During a move, the player has to choose a flower pot which has a non-zero number of seeds; let the index of this flower pot be $$$i$$$ $$$(1 \le i \le n)$$$, then he will do two things:
The player who can not make a move loses, and Sunny goes first.
Sunny and Basil are going to play $$$q$$$ matches; the $$$j$$$-th match $$$(1 \le j \le q)$$$ is going to be played on the subarray from index $$$l_j$$$ to index $$$r_j$$$, inclusive.
Assuming both Sunny and Basil are playing optimally, your task is to find which player wins in each of the $$$q$$$ matches.
The first line of input contains one integer $$$n$$$ $$$(1 \le n \le 2\times 10^5)$$$ — The number of flower pots.
The next line contains $$$n$$$ integers $$$a_1, a_2, ..., a_n$$$ $$$(0 \le a_i \le 10^9)$$$ separated by spaces — The number of seeds in each flower pot.
The next line contains $$$n$$$ integers $$$t_1, t_2, ..., t_n$$$ $$$(1 \le t_i \le n)$$$ separated by spaces — The type of seeds in each flower pot.
The next line contains one integer $$$q$$$ $$$(1 \le q \le 2\times 10^5)$$$ — The number of matches played.
The $$$j$$$-th of the next $$$q$$$ lines contains two integers $$$l_j, r_j$$$ $$$(1 \le l_j \le r_j \le n)$$$ — The boundaries of the subarray on which the $$$j$$$-th match will be played.
For each of the $$$q$$$ matches, output one line containing the name of the winner; output "SUNNY" (without quotes) if the winner was Sunny and "BASIL" (without quotes) otherwise.
6 1 2 3 3 2 1 1 1 1 1 1 1 6 3 4 2 5 1 6 1 3 4 6 5 6
BASIL BASIL BASIL BASIL BASIL SUNNY
3 1 1 1 1 2 3 2 1 2 1 3
SUNNY SUNNY
In the first match in the second sample, there are two flower pots each having only one seed; one of them is of type $$$1$$$ and the other is of type $$$2$$$. Sunny can choose to take the seed from the flower pot of type $$$2$$$ and then set the number of seeds in the flower pot of type $$$1$$$ to $$$0$$$, making every pot empty and thus winning as Basil will not be able to do a move after Sunny's turn.
Basil explaining the rules of the game to Sunny
| Название |
|---|


