Answer
$3$
Work Step by Step
If an object of mass m floats in a liquid, the downward pull of gravity has to be balanced by the upward buoyant force
Thus,
$mg=\rho_{liquid}gV_{sub} $
In the first liquid, which is water, it floats fully submerged: $V_{sub}=V_{block}$
Therefore,
$mg=\rho_{w}gV_{block}................(1)$
In liquid B, the block floats with height $2h/3$ above the liquid surface.
Therefore, the height of the block which is submerged is $(h-2h/3)=h/3$
Now,
$mg=\rho_{A}gV_{sub}$
Using eq. $(1)$, we obtain
or, $\rho_{w}gV_{block}=\rho_{A}gV_{sub}$
or, $\frac{\rho_{A}}{\rho_{w}}=\frac{V_{block}}{V_{sub}}$
or, $\frac{\rho_{A}}{\rho_{w}}=\frac{hA}{\frac{h}{3}A}$
or, $\frac{\rho_{A}}{\rho_{w}}=3$
Therefore, the relative density of B is $3$.