{ NOTE: it is recommended to use this even if you don't understand the following code }

const
    MAXN = 2000;

var
    K, N, T, i, test : LongInt;
    S                : Array[1..MAXN] of AnsiString;

begin
{
    uncomment the two following lines if you want to read/write from files
    assign(input,  'input.txt');  reset(input);
    assign(output, 'output.txt'); rewrite(output);
}

    ReadLn(T);
    for test:=1 to T do begin
        ReadLn(N);

        for i:=1 to N-1 do
            ReadLn(S[i]);

        K := 0;

        { INSERT YOUR CODE HERE }


        WriteLn(K);
    end;

end.
