The inputs represented as X and Y may be 0V correspondingly.
As a result the transistors Q1 and Q2 are OFF, as a result no current flows through the resistor and thereby there will not be any voltage drop across the resistor.
Here, the output voltage Z corresponds to +5V.
When either of the input X= +5V or Y=+5V or both the inputs corresponds to +5V, the corresponding transistor Q1or Q2 or both Q1 and Q2 are ON.
Therefore the output voltage Z=V ce(sat) corresponds to ground and equal to 0V.
Enjoy...😎