We study the linear problem associated with modified affine Toda field
equation for the Langlands dual $\hat{\mathfrak{g}}^\vee$, where
$\hat{\mathfrak{g}}$ is an untwisted affine Lie algebra. The connection
coefficients for the asymptotic solutions of the linear problem are found to
correspond to the $Q$-functions for $\mathfrak{g}$-type quantum integrable
models. The $\psi$-system for the solutions associated with the fundamental
representations of $\mathfrak{g}$ leads to Bethe ansatz equations associated
with the affine Lie algebra $\hat{\mathfrak{g}}$. We also study the
$A^{(2)}_{2r}$ affine Toda field equation in massless limit in detail and find
its Bethe ansatz equations as well as T-Q relations.Comment: 22 page