Let $ABC$ be a triangle, with $AB\neq AC$. Let $O_1$ and $O_2$ denote the centers of circles $\omega_1$ and $\omega_2$ with diameters $AB$ and $BC$, respectively. A point $P$ on segment $BC$ is chosen such that $AP$ intersects $\omega_1$ in point $Q$, with $Q\neq A$. Prove that $O_1$, $O_2$, and $Q$ are collinear if and only if $AP$ is the angle bisector of $\angle BAC$.