var
n,i,j,top:longint;
a,b,c,d,q:Array[0..1000000]of longint;
function big(i,j:longint):boolean;
begin
if (a[i]>a[j])and(b[i]>b[j])and(c[i]>c[j]) then exit(true);
if (a[i]>a[j])and(b[i]>b[j])and(d[i]>d[j]) then exit(true);
if (a[i]>a[j])and(c[i]>c[j])and(d[i]>d[j]) then exit(true);
if (b[i]>b[j])and(c[i]>c[j])and(d[i]>d[j]) then exit(true);
exit(false);
end;
begin
assign(input,'hjjhvf.in'); reset(input);
assign(output,'hjjhvf.out'); rewrite(output);
readln(n);
for i:=1 to n do
begin
readln(a[i],b[i],c[i],d[i]);
end;
for i:=1 to n do
for j:=1 to n do
if (i<>j)and(big(i,j)) then
begin
inc(top);
q[top]:=i;
break;
end;
writeln(top);
for i:=1 to top do writeln(q[i]);
close(input);
close(output);
end.