_&[_,0]=[[]] f&[a,p]=[show x:y|x<-[f+1..a],y<-x&[a,p-1]] main=interact$unlines.map unwords.(0&).map read.words