// Stephen Fulwider
//	Solution to Stones Dynamic Programming Assignment
//	This is a problem known as Longest Increases Subsequence (LIS)

import java.util.Scanner;


public class stones
{

	public static void main(String[] args)
	{
		new stones();
	}
	
	int N; // number of stones in the quarry
	int[] A=new int[100]; // the size of each stone
	int[] max=new int[100]; // our dp array storing the length of the maximum LIS starting with stone i
	
	stones()
	{
		Scanner in=new Scanner(System.in);
		for (int T=in.nextInt(),TC=1; T-->0; ++TC)
		{
			N=in.nextInt();
			for (int i=0; i<N; ++i)
				A[i]=in.nextInt();
			System.out.printf("Row #%d: %d%n", TC,solve());
		}
	}
	
	// solve an instance of the problem
	int solve()
	{
		// max[i] stores the longest increases subsequence starting at stone i
		
		// the last stone in the list can be its own LIS
		max[N-1]=1;
		
		// process the stones in reverse order
		for (int i=N-2; i>=0; --i)
		{
			// this stone can be its own list
			max[i]=1;
			
			// this stone can come before the longest list of any stone after it which is bigger
			//	find the max of all these stones
			for (int j=i+1; j<N; ++j)
				if (A[j]>A[i])
					max[i]=Math.max(max[i],1+max[j]);
		}
		
		// the LIS can start at any stone, so get the largest of all values in max and return it
		int best=max[0];
		for (int i=1; i<N; ++i)
			best=Math.max(best,max[i]);
		return best;
	}

}
