  We construct a solution of an analog of the Schr\"{o}dinger equation for the
Hamiltonian $ H_I (z, t, q_1, q_2, p_1, p_2) $ corresponding to the second
equation $P_1^2$ in the Painleve I hierarchy. This solution is produced by an
explicit change of variables from a solution of the linear equations whose
compatibility condition is the ordinary differential equation $P_1^2$ with
respect to $z$. This solution also satisfies an analog of the Schr\"{o}dinger
equation corresponding to the Hamiltonian $ H_{II} (z, t, q_1, q_2, p_1, p_2) $
of Hamiltonian system with respect to $t$ which is compatible with $P_1^2$. A
similar situation occurs for the $P_2^2$ equation in the Painleve II hierarchy.
