A postage stamp is placed on a surface and a glass cube of refractive index $1.5$ is placed over it. When observed through the cube, the stamp appears at a height of $1.5cm$ from the bottom of the table. Another glass cube made of different material and same thickness is then placed over the first glass cube. This time when observed, the stamp appears at a height of $4cm$ from the bottom of the table. What is the refractive index of the second cube?
I started off by trying to figure out the height of the first cube with the following figure:
$EF$ is the postage stamp. I sampled two rays from the centre of the stamp at an angle of $60$ with the normal (ignore the $30$ in the figure).
Clearly, $\angle NIG = 30$.
Using Snell's Law, $n_{cube}\sin\angle NIG = n_{air}\sin\alpha$
$\implies \frac{3\sin30}{2} = \sin\alpha \implies \alpha = \sin^{-1}\left(\frac{3\sin30}{2}\right)$
Producing the emergent rays backward they intersect at a point $M$. It can be seen that $\tan\angle NMI = \frac{IN}{NM} \space (1)$
Let height of cube equal $h$. $MG = 1.5cm \implies NM = h - 1.5$
$\angle NMI = \alpha, \tan\angle NGI = \frac{IN}{d} \implies IN = d\tan60$
Putting all these together into $(1)$ we get,
$\tan\alpha = \frac{d\tan60}{d - 1.5} \implies d - 1.5 = \frac{d\tan 60}{\tan\alpha} \implies d - 1.5 = \frac{d\tan60}{\tan\left(\sin^{-1}\left(\frac{3\sin30}{2}\right)\right)}$
But, $\frac{\tan60}{\tan\left(\sin^{-1}\left(\frac{3\sin30}{2}\right)\right)} = 1.52752523165$, which would mean that $d - 1.5 = 1.5d$, which makes no sense.
I'll include the image with two blocks too, in case it aids in answering: