$n=pop;for(;;){warn$f,map(int rand 10,1..$n),$/;++$i%1e3 or$f.=int rand 10 and$n--or last}