In the 26th Feynman Lecture, Fermat's principle of least time is discussed and this point about refractive index is brought up:
It is easy to show that there are a number of new things predicted by Fermat’s principle. First, suppose that there are three media, glass, water, and air, and we perform a refraction experiment and measure the index n for one medium against another. Let us call $n_{12}$ the index of air (1) against water (2); $n_{13}$ the index of air (1) against glass (3). If we measured water against glass, we should find another index, which we shall call n23. But there is no a priori reason why there should be any connection between $n_{12}$, $n_{13}$, and $n_{23}$. On the other hand, according to the idea of least time, there is a definite relationship. The index $n_{12}$ is the ratio of two things, the speed in air to the speed in water; $n_{13}$ is the ratio of the speed in air to the speed in glass; $n_{23}$ is the ratio of the speed in water to the speed in glass.
And, Feyman goes into discussing how the refractive indexs have to be related to the ratio of speed of light, however I don't get the point of how the existence of such a relation was predicted by principle of least time. I'm looking for an explanation on this.