Trial and error. I tried this:
X: P(a), P(b), P(c)
Y: P(b), P(d), P(c)
Z: P(a), P(d), P(c)
Check the above. I didn't find any error in it.
Now as per Arjun Sir's answer let's examine option B there:
X: P(b), P(a), P(c)
Y: P(b), P(c), P(d)
Z: P(a), P(c), P(d)
He said to try to access the semaphores in the same order in X, Y and Z. See the semaphores common in X and Y: b & c. See that P(b) occurs first then P(c) in both of them. Check X & Z: a &c. See that P(a) occurs first then P(c). Check Y & Z: c & d. See that P(c) occurs first then P(d). Now check the ordering in my solution. I did it using trial and error basically. Arjun Sir's explanation comes to rescue.