To add three mutually commuting angular momenta $\mathbf{J}=\mathbf{J}_1+\mathbf{J}_2+\mathbf{J}_3$, we may follow this method: add $\mathbf{J}_1$ and $\mathbf{J}_2$ to obtain $\mathbf{J}_{12}=\mathbf{J}_1+\mathbf{J}_2$, then add $\mathbf{J}_{12}$ and $\mathbf{J}_3$ to obtain $\mathbf{J}=\mathbf{J}_{12}+\mathbf{J}_3$.
Denote the eigenstates of $\mathbf{J}^2_k$ and $J_{k,z}$ as $|j_k,m_k\rangle, k=1,2,3$. Then the joint basis that diagonalizes the complete system of commuting observables (CSCO) $\{ \mathbf{J}^2_k, J_{k,z}| k=1,2,3\}$ is the direct product of the corresponding eigenstates, which can be written as $|j_1j_2j_3;m_1m_2m_3\rangle$.
Now, I want to consider the CSCO $\{ \mathbf{J}^2_1,\mathbf{J}^2_2,\mathbf{J}^2_3,\mathbf{J}^2_{12}, \mathbf{J}^2,J_z\}$ with joint eigenstates $|j_1j_2j_3;j_{12},j,m\rangle$. My goal is to express these eigenstates in terms of $|j_1j_2j_3;m_1m_2m_3\rangle$:
For the coupling of $\mathbf{J}_1$ and $\mathbf{J}_2$, we have $$ |j_1j_2;j_{12},m_{12}\rangle= \sum_{m_1}\sum_{m_2} \langle j_1j_2;m_1m_2\mid j_1j_2;j_{12}m_{12}\rangle|j_1j_2;m_1m_2\rangle,$$ where $m_{12}= m_1+m_2$ and $|j_1-j_2|\le j_{12} \le j_1+j_2$. My notes then proceed with saying that by adding $\mathbf{J}_{12}$ and $\mathbf{J}_3$, the eigenstate $|j_1j_2j_3;j_{12},j,m\rangle$ is given by $$ \sum_{m_{12}}\sum_{m_3} \langle j_1j_2;m_1m_2\mid j_1j_2;j_{12}m_2\rangle\langle j_{12}j_3; m_{12}m_3\mid j_1j_2j_3;j_{12},j,m\rangle|j_1j_2j_3;m_1m_2m_3\rangle,$$ where $m = m_{12}+m_3$ and $|j_{12}-j_3|\le j\le j_{12}+j_3$.
I don't see where this last expression is coming from. When adding $\mathbf{J}_1$ and $\mathbf{J}_2$, one could use the resolution of the identity in the old (uncoupled) basis to get the identity above, but how can the last expression be derived?