问题4238--Save the Princess

4238: Save the Princess

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 128 MB

题目描述

Once upon time there was a cute princess called JW living in a castle. One day, the princess had been kidnapped by the robbers. The prince called BH became worried, he wanted to save the princess. So the prince BH and a soldier called LYF went to save the princess.
There were N people standing in a row, including the princess and N-1 robbers,numbered 1 to N from left to right. You already know the princess’ number is K. BH and LYF must kill robbers before meeting the princess. BH and LYF were both very powerful, they took turns killing the robbers. On each turn, a man could kill the left most robber or kill the right most robber. The massacre would end until there was a man to save the princess. The princess would marry the man who saved her first. Assume that BH and LYF kill optimally and LYF kill first, determine the princess would be married to who.

输入

The first line of the input contains an integer T(T <= 500) which means the number of test cases.
For each test case, there are two integers n(3 <= n <= 1000000000) and k(1 < k < n) which mean the number of robbers and the princess’ position.

输出

Output a single line: if the princess would be married to the prince, print ”BH”(without quote), otherwise print ”LYF”(without quote).

样例输入 Copy

5
3 2
4 3
5 2
6 4
6 5

样例输出 Copy

BH
LYF
BH
LYF
LYF

来源/分类