XYZ is an unreleased song recorded on 4 and 5 November 1988, at Sunset Sound in Hollywood, California, during two days off from the Lovesexy Tour. The song was mentioned in the 22 September 1987 draft of the Graffiti Bridge movie script, but it is unclear if the track had been previously recorded, or if Prince had simply had the idea for the song then. The song was also mentioned in the movie script from October 1987. In this version, XYZ was supposed to be sung by the character "Ruthie Washington", who Prince hoped would be played by Madonna.
In July 1989, Prince gave the track (along with My Summertime Thang, Pickle You’re All I Want, U Should Be Mine, Wet Dream Cousin, Vibrator, and The Max) to Eric Leeds to consider reworking for a new Madhouse album (later called 26, which later evolved into Eric Leeds' solo album Times Squared). Eric Leeds did not choose this track to develop further, however.