Bob sees his younger brother, Jack, playing Stepping Stones. He is fascinated by the most interesting game and decides to play it.

Square boxes have been made on the ground with the help of chalk powder, and a number is assigned to each block. Bob is standing in front of these  blocks. From here, he will throw a stone 1 block far, move to that block; pick up the stone and then he will throw the stone two blocks far from here, move to that block; pick up the stone, and throw the stone three blocks far from here, move to that block, and so on. What's the catch of the game??. The catch of the game is to check if it is possible to reach $N^{\mbox{th}}$ block in this manner.  

Bob is a bit lazy. He will make a move only if he is sure that he can reach the $N^{\mbox{th}}$ block. So, tell him if he should make a move or not?  

Input Format 

First line of input contains an integer $\mathbf{T}$ denoting the number of times Bob plays this game. Each of the next $\mathbf{T}$ lines contains a single integer $N$ denoting the $N^{\mbox{th}}$ block.  

Output Format 

Output consists of several lines as per the following criteria: If bob is able to reach $N^{\mbox{th}}$ block, then print Go On Bob with the number of moves required to reach to the $N^{\mbox{th}}$ block both separated by a space. If Bob is not able to reach the $N^{\mbox{th}}$ block, then print Better Luck Next Time.

Constraints

$1\leq T\leq10^5$ 

$1\leq N\leq10^{18}$

Sample Input #00:

1
2

Sample Output #00:

Better Luck Next Time

Explanation: #00:

Bob can jump to the $1^{st}$ Block. From here, he is allowed to make a move to the $3^{rd}$ Block only. So,he cannot step onto $2^{nd}$ Block.  

Sample Input #01:  

1
3

Sample Output #01:

Go On Bob 2

Explanation: #01:

As explained in the previous test case, Bob can make a second move to reach to the $3^{rd}$ Block. So, he can step on $3^{rd}$ block in just 2 moves.

Source: hackerrank | Difficulty: MEDIUM
Tags: Matrices


Solutions:
from math import *
t = int(input())
for i in range(0, t):
	n = int(input())
	j = (1 + sqrt(1 + 8 * n)) / 2
	if abs(j - int(j)) <= 0:
		print('Go On Bob', int(j - 1))
	else:
		print('Better Luck Next Time')


import math
t = int(input())
for _ in range(t):
	x = int(input())
	k = int(math.sqrt(2 * x))
	if k * (k + 1) == 2 * x:
		print('Go On Bob', k)
	else:
		print('Better Luck Next Time')


T = int(input())
for tt in range(T):
	N = int(input())
	L = 0
	R = N + 1
	while L + 1 != R:
		MID = (L + R) // 2
		if MID * (MID + 1) // 2 >= N:
			R = MID
		else:
			L = MID
	if R * (R + 1) // 2 == N:
		print('Go On Bob ' + str(R))
	else:
		print('Better Luck Next Time')


import math
t = int(input())
for i in range(t):
	n = int(input())
	a = 2 * n
	k = int(math.sqrt(a))
	if k * (k + 1) == a:
		print('Go On Bob ' + str(k))
	else:
		print('Better Luck Next Time')


def yesorno(x):
	num = 2 * x
	t = int(num ** 0.5)
	if t * (t + 1) == num:
		return t
	else:
		return 0
tcs = int(input())
for tc in range(tcs):
	sa = int(input())
	if yesorno(sa) == 0:
		print('Better Luck Next Time')
	else:
		print('Go On Bob ' + str(yesorno(sa)))


import math
for t in range(int(input())):
	n = int(input())
	if math.sqrt(1 + 8 * n) % 2 == 1:
		print('Go On Bob ' + str(int((math.sqrt(1 + 8 * n) - 1) / 2)))
	else:
		print('Better Luck Next Time')


t = int(input())
import math
for i in range(0, t):
	k = int(input())
	if math.sqrt(8 * k + 1) == int(math.sqrt(8 * k + 1)):
		if (int(math.sqrt(8 * k + 1)) - 1) % 2 == 0:
			print('Go On Bob ' + str(int((int(math.sqrt(8 * k + 1)) - 1) / 2)))
		else:
			print('Better Luck Next Time')
	else:
		print('Better Luck Next Time')


from math import sqrt
t = int(input())
for i in range(t):
	n = int(input())
	k = int((-1 + sqrt(1 + 8 * n)) / 2)
	if k * (k + 1) // 2 == n:
		print('Go On Bob ' + str(k))
	else:
		print('Better Luck Next Time')


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	a = 8 * N + 1
	b = a ** 0.5
	if int(b) ** 2 == a:
		print('Go On Bob %d' % ((b - 1) // 2))
	else:
		print('Better Luck Next Time')


import math

def triangle(n):
	return n * (n + 1) // 2

def is_triangular(N):
	temp = N
	N *= 2
	N = int(math.sqrt(N))
	if temp == triangle(N):
		print('Go On Bob ' + str(N))
	else:
		print('Better Luck Next Time')
T = int(input())
for t in range(T):
	N = int(input())
	is_triangular(N)


for i in range(int(input())):
	j = int(input())
	h = 0
	p = (-1 + (1 + 8 * j) ** 0.5) / 2
	if p - int(p) == 0:
		print('Go On Bob', int(p))
	else:
		print('Better Luck Next Time')


for i in range(int(input())):
	n = int(input()) * 2
	sq = int(n ** (1 / 2))
	if n == sq ** 2 + sq:
		print('Go On Bob', sq)
	else:
		print('Better Luck Next Time')


import math

def solve_line(line_no, line):
	k = int(line)
	step = -1 / 2 + math.sqrt(1 / 4 + 2 * k)
	return 'Go On Bob ' + str(int(step)) if step == int(step) else 'Better Luck Next Time'

def solve(inputs):
	next(inputs)
	for (line_no, line) in enumerate(inputs, start=1):
		yield solve_line(line_no, line)

def interact(fun):

	def inputs():
		try:
			while True:
				yield input()
		except EOFError:
			pass
	outputs = fun(inputs())
	if outputs is not None:
		for line in outputs:
			print('' if line is None else line)
interact(solve)


T = int(input())
for _ in range(T):
	N = int(input())
	sqrN = int((2 * N) ** 0.5)
	if sqrN * (sqrN + 1) == 2 * N:
		print('Go On Bob', sqrN)
	else:
		print('Better Luck Next Time')


import math
t = int(input())
for x in range(0, t):
	n = int(input())
	steps = int(math.sqrt(2 * n))
	if steps * steps + steps == 2 * n:
		print('Go On Bob', steps)
	else:
		print('Better Luck Next Time')


from math import sqrt

def quadSolution(x):
	return -0.5 + sqrt(8 * x + 1) / 2
T = int(input())
for i in range(T):
	x = float(input())
	potentialSolution = quadSolution(x)
	if potentialSolution.is_integer():
		print('Go On Bob %d' % potentialSolution)
	else:
		print('Better Luck Next Time')


from sys import stdin
T = int(stdin.readline())
for _ in range(T):
	N = int(stdin.readline())
	x = 8 * N + 1
	if int(x ** 0.5) ** 2 == x:
		print('Go On Bob', str(int(x ** 0.5 / 2 - 1 / 2)))
	else:
		print('Better Luck Next Time')


from math import sqrt

def func(n):
	n = 2 * n
	s = int(sqrt(n))
	if s * (s + 1) == n:
		print('Go On Bob %i' % s)
	else:
		print('Better Luck Next Time')
for i in range(int(input())):
	func(int(input()))


from math import sqrt
T = int(input())
for t in range(T):
	N = int(input())
	ans = int((sqrt(N * 8 + 1) - 1) / 2)
	f = lambda n: n * (n + 1) // 2
	while f(ans + 1) <= N:
		ans += 1
	while f(ans - 1) >= N:
		ans -= 1
	if f(ans) == N:
		print('Go On Bob', ans)
	else:
		print('Better Luck Next Time')


import math
t = input()
l = []
for i in range(0, int(t)):
	m = input()
	l.append(int(m))
for i in l:
	if int(math.sqrt(8 * i + 1)) != math.sqrt(8 * i + 1):
		print('Better Luck Next Time')
	else:
		n = (math.sqrt(8 * i + 1) - 1) / 2
		print('Go On Bob ' + str(int(n)))


import math
for i in range(int(input())):
	n = float(input())
	k = int(math.sqrt(n * 2))
	print(['Better Luck Next Time', 'Go On Bob %d' % k][n == k * (k + 1) / 2])


import math
t = int(input())
while t:
	n = int(input()) * 8 + 1
	n = math.sqrt(n)
	if (n - 1) % 2 == 0:
		print('Go On Bob', int((n - 1) / 2))
	else:
		print('Better Luck Next Time')
	t = t - 1


for t in range(int(input())):
	(n, lo, hi) = (int(input()), 1, 10 ** 10)
	while lo < hi:
		mi = (lo + hi) // 2
		if mi * (mi + 1) // 2 >= n:
			hi = mi
		else:
			lo = mi + 1
	if lo * (lo + 1) // 2 == n:
		print('Go On Bob', lo)
	else:
		print('Better Luck Next Time')


import math
T = int(input())
for i in range(T):
	N = int(input())
	sqrt = math.sqrt(8 * N + 1)
	if sqrt == math.trunc(sqrt):
		print('Go On Bob ' + str(int((sqrt - 1) / 2)))
	else:
		print('Better Luck Next Time')


t = int(input())
for _ in range(t):
	n = int(input())
	l = 0
	r = 2000000000
	while r - l > 1:
		m = (l + r) // 2
		m = m * (m + 1) // 2
		if m == n:
			l = r = (l + r) // 2
		elif m < n:
			l = (l + r) // 2
		else:
			r = (l + r) // 2
	if l * (l + 1) == n * 2:
		print('Go On Bob', l)
	elif r * (r + 1) == n * 2:
		print('Go On Bob', r)
	else:
		print('Better Luck Next Time')


T = int(input())
for x in range(T):
	N = int(input())
	a = 8 * N + 1
	b = a ** 0.5
	if b - int(b) == 0:
		c = int((b - 1) / 2)
		print('Go On Bob ' + str(c))
	else:
		print('Better Luck Next Time')


from math import sqrt, floor
for ti in range(int(input())):
	s = int(input())
	n = int(floor(sqrt(s * 2)))
	if n * (n + 1) // 2 == s:
		print('Go On Bob %d' % n)
	else:
		print('Better Luck Next Time')


import math

def solve(n):
	a = 1
	b = 1
	c = n * 2
	res2 = math.sqrt(4 * c + 1)
	resf1 = (res2 - 1) / 2
	return resf1
tests = int(input())
for i in range(tests):
	num = int(input())
	res = solve(num)
	if res.is_integer():
		print('Go On Bob {}'.format(int(res)))
	else:
		print('Better Luck Next Time')


import math
T = int(input())
for i in range(T):
	N = int(input())
	x = N * 8 + 1
	t = math.sqrt(x)
	if t == math.floor(t):
		ans = (t - 1) // 2
		print('Go On Bob %d' % ans)
	else:
		print('Better Luck Next Time')


from math import sqrt
T = int(input())
for i in range(T):
	N = int(input())
	determinant_root = sqrt(8 * N + 1)
	if determinant_root.is_integer():
		nr_steps = int((1 + determinant_root) / 2 - 1)
		print('Go On Bob', nr_steps)
	else:
		print('Better Luck Next Time')


import math
t = int(input())
while t > 0:
	t = t - 1
	stepon = int(input())
	formula = -1 + math.sqrt(1 + 8 * stepon)
	n = int(formula / 2)
	if formula % 2 == 0:
		print('Go On Bob ' + str(n))
	else:
		print('Better Luck Next Time')


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	d = sqrt(1 + 8 * n)
	if d - int(d) != 0:
		print('Better Luck Next Time')
	else:
		res = (int(d) - 1) // 2
		print('Go On Bob', res)


import math

def step_num(n):
	int_sol = int((-1 + math.sqrt(1 + 8 * n)) / 2)
	return int_sol if int_sol * (int_sol + 1) // 2 == n else None
T = int(input())
for _ in range(T):
	N = int(input())
	ans = step_num(N)
	if ans is None:
		print('Better Luck Next Time')
	else:
		print('Go On Bob {}'.format(ans))


from math import sqrt
k = int(input())
while k > 0:
	k -= 1
	n = int(input())
	r = int(sqrt(1 + 8 * n))
	if 1 + 8 * n == r ** 2:
		print('Go On Bob', (r - 1) // 2)
	else:
		print('Better Luck Next Time')


import math

def isTriangular(n):
	guess = int(math.sqrt(2 * n))
	if guess * (guess + 1) == 2 * n:
		return 'Go On Bob %s' % guess
	else:
		return 'Better Luck Next Time'
n = int(input())
for i in range(n):
	x = int(input())
	print(isTriangular(x))


num = int(input())
for i in range(num):
	n = int(input())
	mysum = n * 2
	factor = int(mysum ** 0.5)
	sfactor = factor + 1
	if factor * sfactor == mysum:
		print('Go On Bob ' + str(factor))
	else:
		print('Better Luck Next Time')


import math
t = int(input())
for i in range(t):
	n = int(input()) << 1
	x = math.floor(math.sqrt(n))
	if n == x * (x + 1):
		print('Go On Bob ' + str(x))
	else:
		print('Better Luck Next Time')


import sys

def calcstep(n):
	return n * (n + 1) // 2

def check(n):
	maxval = 10000000000
	minval = 1
	current_val = 10000000000 // 2
	while maxval >= minval:
		result = calcstep(current_val)
		if n == result:
			return current_val
		old = current_val
		if n > result:
			minval = current_val + 1
			current_val = (minval + maxval) // 2
		else:
			maxval = current_val - 1
			current_val = (minval + maxval) // 2
	return None

def resolvestep(n):
	result = check(n)
	if result is None:
		print('Better Luck Next Time')
	else:
		print('Go On Bob {0}'.format(result))
line = sys.stdin.readline()
t = int(line)
for i in range(t):
	line = sys.stdin.readline()
	n = int(line)
	resolvestep(n)


import math

def calc_n(N):
	return (1 + math.sqrt(1 + 8 * N)) / 2

def check_n(n):
	return n == int(n)
for t in range(int(input())):
	N = int(input())
	n = calc_n(N)
	if check_n(n):
		print('Go On Bob {:.0f}'.format(n - 1))
	else:
		print('Better Luck Next Time')


from math import sqrt, floor
good = 'Go On Bob {}'
bad = 'Better Luck Next Time'
T = int(input())
for z in range(T):
	n = int(input())
	d = 0.25 + 2 * n
	if d < 0:
		print(bad)
		continue
	x = -0.5 + sqrt(d)
	msg = good.format(floor(x)) if floor(x) == x else bad
	print(msg)


import math

def solve(N):
	N = -1 + math.sqrt(1 + 4 * 2 * N)
	if N % 2 == 0:
		print('Go On Bob %d' % (N // 2))
	else:
		print('Better Luck Next Time')
for i in range(0, int(input())):
	solve(int(input()))


from math import sqrt

def F(n):
	return n * (n + 1) // 2

def FindSteps(n):
	return int((sqrt(8 * n + 1) - 1) // 2)
T = int(input())
while T:
	T = T - 1
	N = int(input())
	s = FindSteps(N)
	if F(s) == N:
		print('Go On Bob ' + str(s))
	else:
		print('Better Luck Next Time')


for _ in range(int(input())):
	n = int(input()) * 2
	ans = int(n ** 0.5)
	if ans ** 2 + ans == n:
		print('Go On Bob', ans)
	else:
		print('Better Luck Next Time')


import math
t = int(input())
while t != 0:
	t = t - 1
	n = int(input())
	num = 8 * n + 1
	ans = int(math.sqrt(num))
	if num == ans * ans:
		steps = (ans - 1) // 2
		print('Go On Bob {}'.format(steps))
	else:
		print('Better Luck Next Time')


from math import sqrt
for t in range(int(input())):
	x = int(input())
	s = (-1 + sqrt(1 + 8 * x)) / 2
	if s % 1 == 0:
		print('Go On Bob ' + str(int(s)))
	else:
		print('Better Luck Next Time')


import math

def main():
	for case in range(int(input())):
		n = int(input())
		print(check(n))

def check(n):
	m = quad(n)
	return 'Go On Bob %d' % (m - 1) if m != 0 else 'Better Luck Next Time'

def quad(c):
	m = (1 + math.sqrt(1 + 8 * c)) / 2
	return m if m == int(m) else 0
main()


from math import sqrt
for T in range(int(input())):
	N = int(input()) * 2
	x = max(0, int(sqrt(N)) - 1)
	while x * (x + 1) < N:
		x += 1
	print('Go On Bob %d' % x if x * (x + 1) == N else 'Better Luck Next Time')


from math import sqrt
for t in range(int(input())):
	n = int(input())
	x = (sqrt(1 + 4 * 1 * 2 * n) - 1) / 2
	if x.is_integer():
		print('Go On Bob {}'.format(int(x)))
	else:
		print('Better Luck Next Time')


t = int(input())
for i in range(t):
	n = int(input())
	i = (-1 + (1 + 8 * n) ** 0.5) / 2
	if int(i) == i:
		print('Go On Bob', int(i))
	else:
		print('Better Luck Next Time')


def game(N):
	N *= 2
	M = N ** 0.5
	M = int(M)
	if M * (M + 1) == N:
		return 'Go On Bob ' + str(M)
	else:
		return 'Better Luck Next Time'
T = int(input())
for _ in range(T):
	print(game(int(input())))


from math import sqrt

def ist(a):
	p = sqrt(8 * a + 1)
	if not p.is_integer():
		return [False, 0]
	c = (p - 1) / 2
	d = int(c * (c + 1) / 2)
	return [True, int(c)]
T = int(input())
for _ in range(T):
	n = int(input())
	(poss, steps) = ist(n)
	if poss:
		print('Go On Bob', steps)
	else:
		print('Better Luck Next Time')


import math

def main():
	tt = int(input())
	a = []
	for i in range(tt):
		a.append(int(input()))
	for i in range(tt):
		a2 = a[i] * 2
		a2 = math.floor(math.sqrt(a2))
		n = a2 * (a2 + 1) // 2
		if n == a[i]:
			if a[i] == 1:
				a2 = 0
			print('Go On Bob', int(a2))
		else:
			print('Better Luck Next Time')
main()


def solve(N):
	s = int(((1 + 8 * N) ** 0.5 - 1) / 2)
	if s * (s + 1) // 2 == N:
		return s
	else:
		return None
T = int(input())
for _ in range(T):
	N = int(input())
	s = solve(N)
	if solve(N):
		print('Go On Bob %d' % s)
	else:
		print('Better Luck Next Time')


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	a = 8 * N + 1
	b = a ** 0.5
	if int(b) ** 2 == a:
		print('Go On Bob %d' % ((b - 1) // 2))
	else:
		print('Better Luck Next Time')


a = int(input())
for i in range(a):
	c = int(input())
	d = int((2 * c) ** (1 / 2))
	e = int(d * (d + 1))
	if e == 2 * c:
		print('Go On Bob', d)
	else:
		print('Better Luck Next Time')


import math
t = int(input())
while t:
	n = int(input()) * 8 + 1
	n = math.sqrt(n)
	if (n - 1) % 2 == 0:
		print('Go On Bob', int((n - 1) / 2))
	else:
		print('Better Luck Next Time')
	t = t - 1


T = int(input())
for _ in range(T):
	N = int(input())
	n = int((2 * N) ** 0.5)
	if n * (n + 1) == 2 * N:
		print('Go On Bob', n)
	else:
		print('Better Luck Next Time')


import math

def check(n):
	tmp = math.sqrt(8 * n + 1) - 1
	if tmp % 1 == 0:
		return tmp / 2
	else:
		return 0
T = int(input())
for t in range(T):
	N = int(input())
	ans = check(N)
	if ans != 0:
		print('Go On Bob', int(ans))
	else:
		print('Better Luck Next Time')


import math
T = int(input())
for _ in range(T):
	N = int(input())
	if math.sqrt(1 + 8 * N) == round(math.sqrt(1 + 8 * N)):
		time = -0.5 + 0.5 * math.sqrt(1 + 8 * N)
		print('Go On Bob', '%d' % time)
	else:
		print('Better Luck Next Time')


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	a = 8 * N + 1
	b = a ** 0.5
	if int(b) ** 2 == a:
		print('Go On Bob %d' % ((b - 1) // 2))
	else:
		print('Better Luck Next Time')


import math

def is_steppable(n):
	n = n * 2
	x = int(math.sqrt(n))
	res = x * (x + 1)
	if n == res:
		return x
	return -1
t = int(input())
while t > 0:
	n = int(input())
	answer = is_steppable(n)
	if answer != -1:
		print('Go On Bob {}'.format(answer))
	else:
		print('Better Luck Next Time')
	t -= 1


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	a = 8 * N + 1
	b = a ** 0.5
	if int(b) ** 2 == a:
		print('Go On Bob %d' % ((b - 1) // 2))
	else:
		print('Better Luck Next Time')


t = int(input())
for _ in range(t):
	n = int(input())
	b = 0
	e = 10 ** 10
	while b + 1 < e:
		s = (b + e) // 2
		if (s + 1) * s // 2 <= n:
			b = s
		else:
			e = s
	print('Go On Bob ' + str(b) if n == (b + 1) * b // 2 else 'Better Luck Next Time')


import math

def isTriangular(n):
	tmp = math.sqrt(8 * n + 1)
	if int(tmp) == tmp:
		m = (tmp - 1) // 2
		return 'Go On Bob ' + str(int(m))
	else:
		return 'Better Luck Next Time'

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		print(isTriangular(n))
main()


from math import sqrt
t = int(input())
while t:
	t = t - 1
	n = int(input())
	n = n * 2
	x = int(sqrt(n))
	if x * (x + 1) == n:
		print('Go On Bob ' + str(x))
	else:
		print('Better Luck Next Time')


from math import sqrt
t = int(input())
while t:
	t = t - 1
	n = int(input())
	n = n * 2
	x = int(sqrt(n))
	if x * (x + 1) == n:
		print('Go On Bob ' + str(x))
	else:
		print('Better Luck Next Time')


from math import sqrt
T = int(input())
for _ in range(T):
	N = int(input())
	x = (-1 + sqrt(1 + 8 * N)) / 2
	if x.is_integer():
		print('Go On Bob', int(x))
	else:
		print('Better Luck Next Time')


k = int(input())
flag = 0
for i in range(k):
	n = int(input())
	a = (-1 + (1 + 8 * n) ** 0.5) / 2
	if a - int(a) <= 0:
		print('Go On Bob', int(a))
	else:
		print('Better Luck Next Time')


from math import *
t = int(input())
for i in range(0, t):
	n = int(input())
	j = (1 + sqrt(1 + 8 * n)) / 2
	if abs(j - int(j)) <= 0:
		print('Go On Bob', int(j - 1))
	else:
		print('Better Luck Next Time')


t = int(input())
for i in range(t):
	n = int(input())
	x = (-1 + (1 + 8 * n) ** 0.5) / 2
	if x - int(x) == 0:
		print('Go On Bob', int(x))
	else:
		print('Better Luck Next Time')


from math import sqrt
t = int(input())
for i in range(t):
	c = int(input())
	d = sqrt(1 + 8 * c)
	x = (d - 1) // 2
	if int(d) == d:
		print('Go On Bob ', end='')
		print(int(x))
	else:
		print('Better Luck Next Time')


import math
test = int(input())
a = 0
while a < test:
	a += 1
	p = int(input())
	n = math.sqrt(p * 2)
	n = int(n)
	if n * n + n == p * 2:
		print('Go On Bob', n)
	else:
		print('Better Luck Next Time')


test = int(input())
import math

def check(k):
	l = 0
	h = int(math.sqrt(k << 1)) + 5
	while l <= h:
		mid = l + h >> 1
		v = mid * (mid + 1) >> 1
		if v == k:
			return mid
		elif v < k:
			l = mid + 1
		else:
			h = mid - 1
	return -1
for i in range(0, test):
	k = int(input())
	v = check(k)
	if v > 0:
		print('Go On Bob', v)
	else:
		print('Better Luck Next Time')


import math
t = int(input())
for i in range(0, t):
	n = int(input())
	r = (-1 + math.sqrt(1 + 8 * n)) / 2
	if int(r) == r:
		print('Go On Bob', int(r))
	else:
		print('Better Luck Next Time')


from math import sqrt

def is_square(n):
	return int(sqrt(n) + 0.1) ** 2 == n
for _ in range(int(input())):
	num = 8 * int(input()) + 1
	if is_square(num):
		print('Go On Bob', (int(sqrt(num)) - 1) // 2)
	else:
		print('Better Luck Next Time')


import math
for _ in range(int(input())):
	s = int(input())
	n = int(-1 + math.sqrt(8 * s + 1)) // 2
	print('Go On Bob ' + str(n) if n * (n + 1) // 2 == s else 'Better Luck Next Time')


for _ in range(int(input())):
	N = 2 * int(input())
	x = int(N ** 0.5)
	if x * (x + 1) == N:
		print('Go On Bob ' + str(x))
	else:
		print('Better Luck Next Time')


import math
T = int(input())
for _ in range(T):
	N = float(input())
	throws = (math.sqrt(8 * N + 1) - 1) / 2
	if throws == float(int(throws)):
		print('Go On Bob ' + str(int(throws)))
	else:
		print('Better Luck Next Time')


import sys
import math
n = int(sys.stdin.readline())
for i in range(0, n):
	a = int(sys.stdin.readline())
	d = 1 + 8 * a
	if math.sqrt(d) == int(math.sqrt(d)):
		solu = (-1 + int(math.sqrt(d))) / 2
		print('Go On Bob ' + str(int(solu)))
	else:
		print('Better Luck Next Time')


import math
T = int(input())
for i in range(0, T):
	N = int(input())
	res = (math.sqrt(1 + 8 * N) - 1) / 2
	if res.is_integer():
		print('Go On Bob ' + str(int(res)))
	else:
		print('Better Luck Next Time')


import math
n = int(input())
for i in range(0, n):
	num = 2 * int(input())
	b = int(math.sqrt(num))
	if b * (b + 1) == num:
		string = 'Go On Bob ' + str(b)
		print(string)
	else:
		print('Better Luck Next Time')


from math import sqrt, floor, ceil

def isSqr(N):
	k = sqrt(N)
	return floor(k) ** 2 == N or ceil(k) ** 2 == N
for _ in range(int(input())):
	N = int(input())
	k = 1 + 8 * N
	if isSqr(k):
		print('Go On Bob {}'.format(int((-1 + sqrt(k)) / 2)))
	else:
		print('Better Luck Next Time')


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	a = 8 * N + 1
	b = a ** 0.5
	if int(b) ** 2 == a:
		print('Go On Bob %d' % ((b - 1) // 2))
	else:
		print('Better Luck Next Time')


n = int(input().strip())
for _ in range(n):
	v = int(input().strip())
	disc = 1 + 8 * v
	res = (-1 + disc ** 0.5) / 2
	if res == int(res):
		print('Go On Bob %s' % int(res))
	else:
		print('Better Luck Next Time')


t = int(input())
for i in range(t):
	n = int(input())
	a = pow(8 * n + 1, 0.5)
	if a % 1 == 0:
		print('Go On Bob ' + str(int(a - 1) // 2))
	else:
		print('Better Luck Next Time')


import math
n = int(input().strip())
for x in range(0, n):
	num = int(input().strip()) * 2
	sqrt_num = num ** 0.5
	l = math.floor(sqrt_num)
	u = l + 1
	p = l * u
	if p == num:
		print('Go On Bob ' + str(l))
	else:
		print('Better Luck Next Time')


import math
test = int(input())
arr = [None] * test
for i in range(0, test):
	arr[i] = int(input())
for i in range(0, test):
	sq = 1 + 8 * arr[i]
	root = int(math.sqrt(sq))
	if root * root == sq:
		x = (-1 + root) // 2
		print('Go On Bob', x)
	else:
		print('Better Luck Next Time')


import math
t = int(input())

def psquare(apositiveint):
	x = apositiveint // 2
	seen = set([x])
	while x * x != apositiveint:
		x = (x + apositiveint // x) // 2
		if x in seen:
			return False
		seen.add(x)
	return True
for i in range(t):
	N = int(input())
	if psquare(1 + 8 * N) == True:
		steps = int((math.sqrt(1 + 8 * N) - 1) // 2)
		print('Go On Bob ' + str(steps))
	else:
		print('Better Luck Next Time')


import math

def solve(n):
	n = n * 2
	s = math.sqrt(n)
	i = math.floor(s)
	if i * (i + 1) == n:
		return int(i)
	else:
		return 0

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		s = solve(n)
		if s > 0:
			print('Go On Bob {0}'.format(s))
		else:
			print('Better Luck Next Time')
main()


i = int(input())
for x in range(0, i):
	p = int(input())
	k = (-1 + pow(1 + 8 * p, 0.5)) / 2
	o = (-1 + pow(1 + 8 * p, 0.5)) // 2
	if o == k:
		print('Go On Bob', int(o))
	else:
		print('Better Luck Next Time')


import math

def stone():
	n = int(input())
	x = (1 + 8 * n) ** 0.5
	if math.floor(x) == math.ceil(x):
		print('Go On Bob %d' % ((x - 1) / 2))
	else:
		print('Better Luck Next Time')

def main():
	t = int(input())
	for _ in range(t):
		stone()
main()


import sys
import math
T = int(input())
for i in range(0, T):
	N = int(input())
	if (math.sqrt(1 + 8 * N) - 1) % 2 == 0:
		print('Go On Bob', int((math.sqrt(1 + 8 * N) - 1) / 2))
	else:
		print('Better Luck Next Time')


from math import sqrt

def triangle(n):
	x = (1 + sqrt(1 + 8 * n)) / 2
	if x % 1 == 0:
		return int(x - 1)
for _ in range(int(input().strip())):
	t = triangle(int(input().strip()))
	if t is not None:
		print('Go On Bob %d' % t)
	else:
		print('Better Luck Next Time')


T = int(input().strip())
nums = [int(input().strip()) for x in range(T)]
import math

def check_num(N):
	disc = math.sqrt(8 * N + 1)
	if disc % 1 != 0:
		print('Better Luck Next Time')
		return
	soln = int((-1 + disc) / 2)
	print('Go On Bob {}'.format(soln))
	return
	cur_block = 0
	for (ind, i) in enumerate(range(1, 10 ** 18)):
		cur_block += i
		if cur_block == N:
			break
		elif cur_block > N:
			break
[check_num(n) for n in nums]


for i in range(int(input())):
	n = int(input())
	v = (1 + 8 * n) ** 0.5
	from math import floor, ceil
	if floor(v) == ceil(v):
		print('Go On Bob %d' % ((v - 1) / 2))
	else:
		print('Better Luck Next Time')


num_tests = int(input().strip())
for test in range(num_tests):
	sq = int(input().strip())
	dbl_sq = sq * 2
	rt_dbl_sq = int(dbl_sq ** 0.5)
	if rt_dbl_sq * (rt_dbl_sq + 1) == dbl_sq:
		print('Go On Bob', rt_dbl_sq)
	else:
		print('Better Luck Next Time')


from sys import stdin
from math import sqrt
from ctypes import c_longlong as ll
r = stdin.readline
numCases = int(r())
for line in range(numCases):
	x = int(r())
	tmp = int(sqrt(2 * x))
	if tmp * tmp + tmp == 2 * x:
		print('Go On Bob ' + str(tmp))
	else:
		print('Better Luck Next Time')


from math import sqrt

def fo(n):
	(mi, ma) = (0, int(10000000000.0))
	while mi < ma:
		mid = (mi + ma) // 2
		if mid * (mid + 1) // 2 < n:
			mi = mid + 1
		else:
			ma = mid
	return mi
for xx in range(int(input())):
	n = int(input())
	k = fo(n)
	if k * (k + 1) // 2 == n:
		print('Go On Bob %d' % k)
	else:
		print('Better Luck Next Time')


import math

def is_square(integer):
	root = math.sqrt(integer)
	if int(root + 0.5) ** 2 == integer:
		return True
	else:
		return False
for no in range(int(input())):
	m = int(input())
	delta = 1 + 8 * m
	if is_square(delta) == False:
		print('Better Luck Next Time')
	else:
		print('Go On Bob ' + str(int((math.sqrt(delta) - 1) / 2)))