A = Sodium bicarbonate (NaHCO₃) — used in soda-lime fire extinguishers.
B = Sodium carbonate (Na₂CO₃) — formed on heating A; used to remove permanent hardness of water.
$$2\text{NaHCO}_3 \xrightarrow{\Delta} \text{Na}_2\text{CO}_3 + \text{H}_2\text{O} + \text{CO}_2$$
The key clues are: (1) used in soda-acid fire extinguisher → NaHCO₃; (2) decomposes on heating → Na₂CO₃ (washing soda); (3) washing soda removes permanent hardness by precipitating Ca²⁺/Mg²⁺ ions. Examiners expect both compounds identified with correct formula.