Manhattan in the year 2025 is so densely populated that its old two-dimensional grid of streets and avenues no longer provides enough space for all the traditional vehicles such as cars, bicycles, or buses. As a result the newly developed 3D-Skyjetters have become very popular, because they let you skip the traffic jams on the ground by flying through the air. After a series of horrible accidents caused by 3D-Skyjetters cutting corners, the city authorities have introduced new air-traffic regulations and are determined to enforce them rigorously. The key rule is that a 3D-Skyjetter must follow virtual airways laid out on a three-dimensional rectangular grid.
You run a company that rents out 3D-Skyjetters. Because 3D-Skyjetters are still far from economical, your customers keep running out of petrol at the worst possible places, so you need a system that can tell them their current range at any time.
Assume that travelling from one intersection to an adjacent one in the grid always costs one unit of petrol, no matter whether the customer moves horizontally or vertically, up or down. Assume also that the customer sits at some intersection where movement is not restricted by the ground or by any obstacle, but only by the amount of petrol left.
Given the amount of petrol, draw a textual picture of every intersection the customer can reach, together with the amount of petrol needed to get there.
The first line contains the number of scenarios. Each scenario is a single line holding one integer u, the units of petrol remaining, with 0≤u≤9. If more than 9 units remain, the customer ignores the display anyway.
For each scenario, begin the output with a line Scenario #i:, where i is the scenario number starting at 1. Then print a textual picture of every intersection reachable with the given amount of petrol, together with the petrol needed to reach it.
In this picture, print the slices of the smallest axis-aligned cube that contains every intersection in range, labelling the slices from the bottom to the top starting at 1. Begin each slice with a line slice #s:, where s is the slice number. On the lines that follow, draw the intersections of that slice using:
0 to 9 for intersections in range, showing the petrol needed to get there, and. for intersections that are out of range.Separate consecutive scenarios with a single blank line. (There is no blank line after the final scenario.)