1. 

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 231 Testing the Catcher
* Link: http://uva.onlinejudge.org/external/2/231.pdf
*
* @author Barny Porcio
* @version 1.0, 07/01/2010
*
* Method : -
* Status : Accepted
* Runtime: 0.100
*/



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;

public class catcher231 {

/**
* @param args
* @throws IOException
* @throws NumberFormatException
*/
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int testcase = 1;
boolean firstcase = true;
while(true){
int first = Integer.parseInt(br.readLine());
if (first == -1)
return;
LinkedList<Integer> ll = new LinkedList<Integer>();
ll.add(first);
int temp = Integer.parseInt(br.readLine());
while (temp != -1){
ll.add(temp);
temp = Integer.parseInt(br.readLine());
}

int longest[] = new int[ll.size()];
longest[0] = 1;
int allerlaengste = 1;
for (int i = 1; i < ll.size(); ++i){
int laengstes = -1;
for (int i2 = i-1; i2 >= 0; --i2){
if (ll.get(i2)>ll.get(i) )
if (laengstes == -1 || longest[laengstes] < longest[i2])
laengstes = i2;

}
if (laengstes == -1)
longest[i] = 1;
else
longest[i] = longest[laengstes]+1;
if (longest[i] > allerlaengste )
allerlaengste = longest[i];

}
if (firstcase)
firstcase = false;
else
System.out.println();
System.out.println("Test #"+testcase+":");
System.out.println(" maximum possible interceptions: "+allerlaengste);
++testcase;

}

}

}