cupcake-challenge-1

Hansa did not have enough money to pay the bill of the party. Now she loves cupcakes (and can also eat any amount of it apparently), so she came up with a cupcake challenge. She challenges t people individually every time for the challenge.  The task is as follows:

Given 3 baskets filled with known amount of cupcakes in each, turn-by-turn, both the competitors have to eat at least one cupcake to at most all the cupcakes from any one basket. The one, who eats the last cupcake of all, is the winner and the other person has to pay the entire bill of the party. All the competitors, including Hansa, will play optimally. Now as Hansa is the birthday girl, she always takes the first turn. Tell us who wins each challenge.

Input:
The first line contains a single positive integer, T. T test cases follow. Each of the next T lines contain 3 space-separated integers “a b c” denoting the number of cupcakes in each basket.

Output:
A single line for each test case telling if Hansa has to pay the bill or not. If she loses the game then print “BILL” otherwise print “NO BILL”.

Constraints:
1 ≤ t ≤ 100
1 ≤ a, b, c ≤ 10^6

Problem Setter: Chintan Shah

SAMPLE INPUT
2
1 1 1
1 2 3

SAMPLE OUTPUT
NO BILL
BILL

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
T=eval(input())
for _ in range(T):
	a,b,c=list(map(int,input().split()))
	if(a^b^c==0):
		print("BILL")
	else:
		print("NO BILL")


t=eval(input())
while t:
	a=list(map(int, input("").split()))
	ans=a[0]
	for i in a[1:]:
		ans=ans^i
	if ans:
		print("NO BILL")
	else:
		print("BILL")
	t-=1