A More active metal displaces a less active metal from solution.
Basically, the more active metal will be more reactive with other metals.
From Diagram 1 - We can tell that Metal X is a more active metal than metal Y because it reacts with Y2+ ions forming deposits of metal Y on metal X. X>Y
From Diagram 2 - Metal Z is more active than metal Y , metal Y deposits on Metal Z as metal Z is more reactive than Metal Y. Z>Y
From Diagram 3 - Metal X is less reactive with Metal Z , this is because a non-active metal cannot displace a more reactive metal. This can be seen as metal Z does not deposit on metal X. Thus Z>X
Overall
X>Y , Z>Y and Z>X
Z>X>Y