Since most contestants do not read this part, I have to repeat that Bitlandians are quite weird. They have their own jobs, their own working method, their own lives, their own sausages and their own games!

Since you are so curious about Bitland, I'll give you the chance of peeking at one of these games.

BitLGM and BitAryo are playing yet another of their crazy-looking genius-needed Bitlandish games. They've got a sequence of n non-negative integers a_1, a_2, ..., a_{n}. The players make moves in turns. BitLGM moves first. Each player can and must do one of the two following actions in his turn:

  Take one of the integers (we'll denote it as a_{i}). Choose integer x (1 ≤ x ≤ a_{i}). And then decrease a_{i} by x, that is, apply assignment: a_{i} = a_{i} - x.  Choose integer x $(1 \leq x \leq \operatorname{min}_{i = 1} a_{i})$. And then decrease all a_{i} by x, that is, apply assignment: a_{i} = a_{i} - x, for all i. 

The player who cannot make a move loses.

You're given the initial sequence a_1, a_2, ..., a_{n}. Determine who wins, if both players plays optimally well and if BitLGM and BitAryo start playing the described game in this sequence.


-----Input-----

The first line contains an integer n (1 ≤ n ≤ 3).

The next line contains n integers a_1, a_2, ..., a_{n} (0 ≤ a_{i} < 300).


-----Output-----

Write the name of the winner (provided that both players play optimally well). Either "BitLGM" or "BitAryo" (without the quotes).


-----Examples-----
Input
2
1 1

Output
BitLGM

Input
2
1 2

Output
BitAryo

Input
3
1 2 1

Output
BitLGM

Source: codeforces | Difficulty: HARD
Tags: Dynamic programming

Game theory


Solutions:
from math import *
n = int(input())
if n == 3:
	li = list(map(int, input().split()))
	ans = 0
	flag = 0
	for i in li:
		ans ^= i
	if ans == 0:
		print('BitAryo')
	else:
		print('BitLGM')
elif n == 2:
	li = list(map(int, input().split()))
	li.sort()
	phi = (1 + sqrt(5)) / 2
	ch = [0] * 785
	for i in range(300):
		a = floor(phi * i)
		b = floor(phi ** 2 * i)
		ch[a] = b
		ch[b] = a
	if ch[li[0]] == li[1]:
		print('BitAryo')
	else:
		print('BitLGM')
else:
	li = int(input())
	if li == 0:
		print('BitAryo')
	else:
		print('BitLGM')