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

{ constraints }
const
    MAXN = 1000;

{ input data }
var
    N, M, i, j : longint;
    V, K, L, R : array[0..MAXN-1] of longint;
    E, C, T    : array[0..MAXN-1, 0..MAXN-1] of longint;

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

    readln(N);
    for i:=0 to N-1 do begin
        readln(V[i], K[i], L[i]);
        for j:=0 to K[i]-1 do read(E[i,j]);
        readln();
        for j:=0 to L[i]-1 do read(C[i,j]);
        readln();
        for j:=0 to L[i]-1 do read(T[i,j]);
        readln();
    end;
    readln();

    { insert your code here }
    M := 2;
    R[0] := 0;
    R[1] := N-1;

    { print the solution }
    writeln(M);
    for i:=0 to M-1 do
        write(R[i], ' ');
    writeln();
end.
