This page is still under construction.

Parts of this page are still being built. What you see may change.

Jenga

Time limit1sMemory limit128 MB

Summary
Check each three-block row for two adjacent missing blocks and report whether each tower stands.
Level

Easy1 of 10

Topics
Implementation, String
Solved
No attempts yet

Problem

You are writing a program that plays Jenga, and the first thing it needs is a way to tell which towers are still up. Given several Jenga towers, decide for each one whether it is standing or has fallen.

A tower falls when two horizontally adjacent blocks in the same row are both missing. Gaps that sit above one another in the same column do not count. The top row is no exception: two adjacent missing blocks in the top row also make the tower fall.

Input

The first line contains the number of test cases.

Each test case begins with a single integer, the height of the Jenga tower. The next lines give the state of one row each. Every row is three characters long, where 1 is a block that is still in place and 0 is a block that has been pulled out.

There are between 1 and 100 test cases, and each tower has a height between 1 and 20.

Output

For each test case, print Case x: on a line of its own, where x is the case number, then a single space, then Fallen if the tower has fallen or Standing if it is still up.

Examples2

  1. Example 1

    Input
    4
    8
    111
    111
    111
    100
    101
    111
    010
    111
    4
    111
    111
    101
    101
    5
    000
    111
    111
    111
    101
    8
    111
    010
    111
    011
    100
    101
    101
    111
    
    Expected output
    Case 1: Fallen
    Case 2: Standing
    Case 3: Fallen
    Case 4: Fallen
    
  2. Example 2

    Input
    2
    1
    111
    1
    001
    
    Expected output
    Case 1: Standing
    Case 2: Fallen