for i in range(int(input())): a,b = map(int, input().split()) print("NO BRAINS" if a < b else "MMM BRAINS")