Solution to the problem 'Bot saves princess - 2'