var
n,i,j,ans:longint;
a,b,c,d:array[1..100000] of longint;
p:array[1..100000] of boolean;
begin
assign(input,'hjjhvf.in'); reset(input);
assign(output,'hjjhvf.out'); rewrite(output);
readln(n);
for i:=1 to n do
readln(a[i],b[i],c[i],d[i]);
for i:=1 to n do
for j:=1 to n do
begin
if (a[i]>a[j])and(b[i]>b[j])and(c[i]>c[j]) then begin inc(ans); p[i]:=true; break; end;
if (a[i]>a[j])and(b[i]>b[j])and(d[i]>d[j]) then begin inc(ans); p[i]:=true; break; end;
if (a[i]>a[j])and(c[i]>c[j])and(d[i]>d[j]) then begin inc(ans); p[i]:=true; break; end;
if (b[i]>b[j])and(c[i]>c[j])and(d[i]>d[j]) then begin inc(ans); p[i]:=true; break; end;
end;
writeln(ans);
for i:=1 to n do
if p[i] then writeln(i);
close(input); close(output);
end.