One nice task from Amazon is solved.