Solving a simple puzzle