Three bar magnets, X, Y, and Z, are positioned in a non-magnetic guide track as shown in the diagram.

Magnet Y is removed, rotated through 180∘ 180^\circ\,180∘ horizontally, and then placed back into its original position between Magnet X and Magnet Z.
How does this rotation affect the magnetic forces acting on Magnet Y?
Magnet Y now attracts Magnet X and repels Magnet Z
Magnet Y now repels Magnet X and attracts Magnet Z
Magnet Y now repels both Magnet X and Magnet Z
Magnet Y now attracts both Magnet X and Magnet Z