Chapter 120: The Magic Algorithm