A white solid 'P', on strong heating, decomposes to give reddish brown gas 'R' and a residue 'Q' and a colourless gas. The residue 'R' is yellow when hot and white when cold. The solution of white solid 'P' in water gives white precipitate 'S' with conc. NaOH. The white form colourless solution. Identify 'P', 'Q', 'R', 'S' and write the chemical reactions involved.