Islands in the Data Stream

No attempts yetTime limit1sMemory limit256 MB

Problem

In a sequence of integers a1,a2,,ana_1, a_2, \dots, a_n, an island is a contiguous subsequence that satisfies both of the following conditions.

  • Every number in the island is greater than the number immediately before the subsequence starts.
  • Every number in the island is greater than the number immediately after the subsequence ends.

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.

Input

The first line contains the number of test cases PP. (1P10001 \le P \le 1000)

Each of the next PP lines holds one test case: the test case number TT followed by 12 non-negative integers, separated by spaces. The first and the last of the 12 integers are always 0.

Output

For each test case, print the test case number and the number of islands on one line, separated by a single space.