main=interact f f(a:b:c)=unlines[([1..mod(8^i*read[a])13]>>" ")++e|i<-[1..read d]]where(d,_:e)=span(>b)c