$\begin{array}{l} Cl -\left( CH _2\right)_4- Cl \xrightarrow{\text { excess } NH _3} A \xrightarrow{ NaOH } \\ B + H _2 O + NaCl\end{array}$