CF2180H2 Bug Is Feature (Conditional Version)

Description

This is the conditional version of the problem. The difference between the versions is that in this version, the "non-decreasing common difference" is present. You can hack only if you solved all versions of this problem. Note that neither version is necessarily easier than the other, and they can be solved independently. Bug and Feature are immersed in a game of Sequence. In this unique version of the Sequence game, a sequence begins with three positive integers $ a < b < c \le x $ , forming an arithmetic progression (i.e., $ b-a=c-b $ ). During each turn, a player can selectively increase one of $ a $ , $ b $ , or $ c $ by a positive integer. After the move, the numbers must retain their arithmetic progression, possibly with a new order, and a common difference not less than the previous one. Moreover, none of $ a $ , $ b $ , or $ c $ should exceed $ x $ . Not content with the conventional Sequence game, Bug and Feature decide to engage in a $ n $ series of Sequence games simultaneously. For the $ i $ -th series, they are provided with five numbers $ a_i < b_i < c_i \le l_i \le r_i $ . They will play a game with numbers $ a_i < b_i < c_i \le x $ for every integer $ x $ in the range $ [l_i, r_i] $ (resulting in a total of $ \sum_{i=1}^n (r_i - l_i + 1) $ games). Taking turns, they play all the games together, with Bug starting first and then Feature. In each turn, a player selects an unfinished game and makes a move in that game. The player who cannot make a move loses. Now, the question is: if both players play optimally, who will emerge victorious?

Input Format

Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 10^5 $ ). The description of the test cases follows. The first line of each test case consists of a single integer $ n $ ( $ 1 \le n \le 2 \cdot 10^5 $ ) — the number of series of games that Bug and Feature wish to play. Each of the next $ n $ lines contains five integers $ a_i, b_i, c_i, l_i, r_i $ — ( $ 1 \le a_i < b_i < c_i \le l_i \le r_i \le 10^{18} $ ), representing the specifications of the $ i $ -th series of games. $ a_i $ , $ b_i $ , and $ c_i $ form an arithmetic progression. $ (c_i-b_i=b_i-a_i) $ The sum of $ n $ over all test cases is at most $ 2 \cdot 10^5 $ .

Output Format

For each test, output $ \mathtt{Bug} $ if Bug wins, and $ \mathtt{Feature} $ if Feature wins.

Explanation/Hint

In the first test case, no valid move is possible at the beginning of the game. Therefore, Bug cannot perform any action, and Feature wins immediately. In the second test case, there are $ 3 $ instances of the game, corresponding to each value of $ x $ in the range $ 8 $ to $ 10 $ . The sequence in each instance is initially $ 2,\;4,\;6 $ . Bug can secure a winning strategy as follows: 1. In the instance with $ x = 10 $ , Bug changes $ b $ from $ 4 $ to $ 10 $ . As a result, the sequence becomes $ 2,\;6,\;10 $ , and it is easy to verify that no further move is possible in this instance. 2. Next, Feature must play by changing the value $ a $ from $ 2 $ to $ 8 $ in one of the remaining two instances (either the game with $ x = 8 $ or $ x = 9 $ ). 3. Regardless of Feature's choice, Bug responds by changing the value $ a $ to $ 8 $ in the other instance. After this move, the sequence in that instance also becomes fixed, and no further operation can be performed. Thus, after these moves, all three instances reach states where no player can make any additional move, ensuring Bug's victory.