R, my two bits on the agony aunt column.

X has no business getting involved with Z in the first place. whether he mentioned that in the first place or not to Z is immaterial. X has committed himself to Y.

Y is not invloved in the whole drama yet, but is being shortchanged in her rightful due whether it is love, affection or simply time from X,

Z is the outsider here and before she gets hurt more, get out of the situation ASAP.

Sometimes matters of the heart are best dealt with using the head.