Solution (source code)

= Solution

Apply the rational <Serre spectral sequence> to the path-loop fibration of $K(\mathbb Z,3)$. Its fiber is
$$
\Omega K(\mathbb Z,3)\simeq K(\mathbb Z,2)\simeq\mathbb{CP}^{\infty},
$$
whose rational <cohomology ring> is $\mathbb Q[c]$ with $|c|=2$. Since the path space is contractible, $c$ must transgress to a nonzero class $x\in H^3(K(\mathbb Z,3);\mathbb Q)$. Multiplicativity gives
$$
d_3(c^m)=m c^{m-1}x.
$$
Over $\mathbb Q$ these differentials pair and kill every positive-degree class except $x$, while graded commutativity gives $x^2=0$. Hence
$$
H^i(K(\mathbb Z,3);\mathbb Q)\cong
\begin{cases}
\mathbb Q,&i=0,3,\\
0,&\text{otherwise}.
\end{cases}
$$