In a sequence of integers a1,a2,…,an, an island is a contiguous subsequence that satisfies both of the following conditions.
The figure below marks every island in three sequences.

In this problem the sequence always consists of 12 non-negative integers. The first and the last number are 0, so an island lies entirely within the second number through the eleventh number.
Count the islands in each sequence and print that count.
The first line contains the number of test cases P. (1≤P≤1000)
Each of the next P lines holds one test case: the test case number T followed by 12 non-negative integers, separated by spaces. The first and the last of the 12 integers are always 0.
For each test case, print the test case number and the number of islands on one line, separated by a single space.