(*
 * II Всероссийская Командная Олимпиада Школьников по Программированию
 *
 * Задача:      Яблоко от яблони...
 * Автор:       Денис Степуленок
 * Решение:     Андрей Станкевич
 *)

{$A+,B-,D+,E+,F-,G+,I+,L+,N+,O-,P+,Q+,R+,S+,T-,V-,X+,Y+}
{$M 65520,0,655360}

program apples;

var
    x, y, z, r: array [1..200] of longint;
    a: array [1..200, 1..200] of boolean;
    u: array [1..200] of boolean;
    i, j, k, n: longint;
    
procedure find(x: longint);
var
    i: longint;
begin
    u[x] := true;
    for i := 1 to n do
        if a[x][i] and not u[i] then
            find(i);
end;    
    
begin
{    assign(input, 'input.txt');
    reset(input);
    assign(output, 'output.txt');
    rewrite(output);}
    
    read(n);
    for i := 1 to n do
    begin
        read(x[i], y[i], z[i], r[i]);
        if (abs(x[i]) > 10000) then
        begin
            writeln('fatal! apple ', i, ' x is too huge');
            runerror(254);
        end;
        if (abs(y[i]) > 10000) then
        begin
            writeln('fatal! apple ', i, ' y is too huge');
            runerror(254);
        end;
        if (abs(z[i]) > 10000) then
        begin
            writeln('fatal! apple ', i, ' y is too huge');
            runerror(254);
        end;
        if (abs(r[i]) > 10000) then
        begin
            writeln('fatal! apple ', i, ' r is too huge');
            runerror(254);
        end;
        z[i] := z[i] - r[i];
    end;
    
    for j := 1 to n do
        for k := 1 to n do
            if (j <> k) and 
                ((sqr(x[j] - x[k]) + sqr(y[j] - y[k]) + sqr(z[j] - z[k])) <= sqr(r[j] + r[k])) then
            begin
                writeln('fatal! apples ', j, ' and ', k, ' touch or intersect: ',
                    (sqr(x[j] - x[k]) + sqr(y[j] - y[k]) + sqr(z[j] - z[k])), ' <= ',
                    sqr(r[j] + r[k]), '!');
                runerror(255);
            end;
    
    for j := 1 to n do
        for k := 1 to n do
        begin
            if (sqr(x[j] - x[k]) + sqr(y[j] - y[k]) <= sqr(r[j] + r[k])) and (z[k] < z[j]) then
                a[j][k] := true;
        end;
            
    find(1);
    
    j := 0;
    for i := 1 to n do
        if u[i] then inc(j);
    writeln(j);
    for i := 1 to n do
        if u[i] then
            write(i, ' ');
    
    close(input);
    close(output);
end.
