Let me give you a hint. Do you know about Lorentz force ? Lorentz force is the force experienced by a charged particle moving in an electromagnetic field. In this case, the charged particles flowing through Z are under the influence of the magnetic field created by the currents carried by X and Y. So you need to calculate the resultant Lorentz force on Z due to the magnetic fields created by X and Y.
If you've learned about relativity, its allways cool to look at these problems relativistically, which is where magnetic fields emerge from anyways.
If the current between 2 wires next to each other is moving in opposite directions (so the electrons are moving in opposite directions), electrons will each see electrons from the other wire moving past them really really fast. This means that they'll see the space that the electrons in the opposite wire are in contract, the field density of electrons in the other wire increase, and will feel a net negative charge in the other wire, thus getting repelled.
On the other hand, if the currents are flowing in the same direction, electrons in one wire will see the electrons in the other wire as flowing in the same direction at the same velocity, therefore not moving relative to each other. However, from their point of view they will see protons move by really, really fast, therefore the space the protons exist in contracts, the positive field density increases, and they feel a net positive charge in the other wire, and get attracted.
Currents same direction -> Attract
Current Different direction -> Repel
Here is a really good video that shows this without any fancy math:
Finally, the strength of the attraction and repulsion is inversely proportional to the distance between the wires.
I think you have enough to solve your problem now.