A body X is in thermal equilibrium with Y and Y is in thermal equilibrium with Z, then
X is in thermal equlibrium with Z
When X is in thermal equilibrium with Y and Y is in thermal equilibrium with Z, it is necessary that X and Z will be in thermal equilibrium with each other.