// Written by a 2005 BHCSI TA.
// Slightly edited by Arup Guha for the 2006 BHCSI Mock Contest
// to utilize the Scanner.

import java.io.*;
import java.util.*;

class kalamazoo
{
	public static void main(String[] args) throws IOException
	{
		
        Scanner in = new Scanner(new File("kalamazoo.in"));

		// Read in the number of input cases.
		int n = in.nextInt();
		for (int i=0;i<n;i++)
		{
			// Get a list of the number of trains.
			int size = in.nextInt();
			
			// Deal with the trivial cases.
			if (size <= 0)
			{
				System.out.println("Train "+(i+1)+": Just another day at the trainyard.");
				continue;
			}
			
			// Read in the weight of all the cars.
			double[] train = new double[size];
			for (int j=0;j<size;j++)
				train[j] = in.nextDouble();
			
			// Loop through all triplets of consecutive cars.
			boolean toobig = false;
			for (int j=0;j<size;j++)
			{
				double sum = 0.0;
				
				// Add in the car two cars in front of car j if it exists.
				if (j-2 >= 0)
					sum += train[j-2];
					
				// Add in the car in front of car j if it exists.
				if (j-1 >= 0)
					sum += train[j-1];
					
				// Add in the current car.
				sum += train[j];
				
				// See if these set of cars weighs too much.
				if (sum > 1000.0)
				{
					toobig = true;
					break;
				}
			}
			
			// Output the result.
			if (toobig)
				System.out.println("Train "+(i+1)+": Kalamazoo is doomed!");
			else
				System.out.println("Train "+(i+1)+": Just another day at the trainyard.");
		}
	}
}