main=interact$unlines.(>>=(init#)).(tail#) f#[]=[] f#t=f#(f t)++[t]