Case #1: ZZY
Case #2: Z
Case #3: ZYYXXYZ
Case #4: ZYZX
