main=interact(%1) l%x=take x l++min('\n':drop x(words l>>=id)%(x+1))l