1
2
3
4
5
a = list(map(int,input().split()))
b = list(map(int,input().split()))
wa = [sum(a)]+[a.count(i) for i in range(10,0,-1)]
wb = [sum(b)]+[b.count(i) for i in range(10,0,-1)]
print("Algosia" if wa>wb else "Bajtek" if wb>wa else "remis")