X = -1nC
Y = 1.5nC
Z = 1.5nC
This questions is all about conservation of charge. When two spheres touch the total charge is distributed evenly across both spheres. (This is because they are identical, if they weren't we'd have to look at their relative sizes)
So when sphere X and Y touch the total charge between them is:
3nC + -5nC = -2nC. The charge is evenly distributed so both spheres have -1nC of charge on them.
We can repeat this with Y and Z
Total Charge = -1nC + 4nC = 3nC. Evenly distributed over the two spheres gives us 1.5nC of charge on Y and Z.
*Be careful with the units of charge in this sort of question, as long as the charges are measured in Coulombs, this method works. If instead you are measuring in elementary charges, the can not be any fractional charges in your answer.