Solving the controllability problem for a nonlinear three-dimensional system