Solution to Angry Children problem.