f l r[t,y]|y>0=concat[f(l++' ':show x)x[t,y-1]|x<-[r+1..t]]|True=tail l++"\n" main=getLine>>=putStr.f[]0.map read.words