Step 1: Understand the reactions.
Y turns the dichromate paper green due to the formation of a sulfate, while Z causes the lead acetate paper to turn black due to the formation of sulfides.
Step 2: Conclusion.
Thus, the compounds are sodium sulfite and sodium sulfide.
Final Answer:
\[
\boxed{B}
\]