Solve BinaryTreeLock.