// Arup Guha
// 5/9/2015
// Alternate Solution to BHCSI Homework Problem: Stones
// Uses memoization

import java.util.*;

public class stonesmemo {

    public static int[] values;
    public static int[] memo;
    final public static int MAXVALUE = 100;

    public static void main(String[] args) {

        Scanner stdin = new Scanner(System.in);
        int numCases = stdin.nextInt();

        // Go through each case.
        for (int loop=1; loop<=numCases; loop++) {

            // Read in the values and set up memo array.
            int n = stdin.nextInt();
            values = new int[n];
            memo = new int[n];
            Arrays.fill(memo, -1);
            for (int i=0; i<n; i++)
                values[i] = stdin.nextInt();

            // The way we've categorized the problem, we have to try each item as our ending
            // point.
            int res = 1;
            for (int i=n-1; i>=0; i--)
                res = Math.max(res, solve(i));

            // Solve and output.
            System.out.println("Row #"+loop+": "+res);
        }
    }

    // Returns the LCS of indexes 0...k that ENDS in index k.
    public static int solve(int k) {

        // The LIS of an empty sequence is size 0.
        if (k < 0) return 0;
        if (memo[k] != -1) return memo[k];

        // Try each item, from 0 to k-1 as the last item
        // before item k.
        int res = 1;
        for (int i=0; i<k; i++)
            if (values[i] < values[k])
                res = Math.max(res, 1+solve(i));


        // Store and return.
        memo[k] = res;
        return res;
    }
}
