  General concept of a gradation slicing is used to analyze polynomial
solutions of ordinary differential equations (ODE) with polynomial
coefficients, ${\cal L}\psi=0$, where ${\cal L}=\sum_l p_l(z) d_z^l$, $p_l(z)$
are polynomials, $z$ is a one-dimensional coordinate, and $d_z=d/dz$. It is not
required that ODE is either (i) Fuchsian or (ii) leads to a usual
Sturm-Liouville eigenvalue problem. General necessary and sufficient conditions
for the existence of a polynomial solution are formulated involving constraint
relations. The necessary condition for a polynomial solution of $n$th degree to
exist forces energy to a $n$th baseline. Once the constraint relations on the
$n$th baseline can be solved, a polynomial solution is in principle possible
even in the absence of any underlying algebraic structure. The usefulness of
theory is demonstrated on the examples of various Rabi models. For those
models, a baseline is known as a Juddian baseline (e.g. in the case of the Rabi
model the curve described by the $n$th energy level of a displaced harmonic
oscillator with varying coupling $g$). The corresponding constraint relations
are shown to (i) reproduce known constraint polynomials for the usual and
driven Rabi models and (ii) generate hitherto unknown constraint polynomials
for the two-mode, two-photon, and generalized Rabi models, implying that the
eigenvalues of corresponding polynomial eigenfunctions can be determined
algebraically. Interestingly, the ODE of the above Rabi models are shown to be
characterized, at least for some parameter range, by the same unique set of
grading parameters.
