Answer
Substance $A$ is most dense.
Work Step by Step
As we know, the relation between $cm^3$ and $m^3$ is: $$1 \space m^3 = 10^6 \space cm^3$$
And the relation between kg and g is:
$$1 \space kg = 10^3 \space g$$
Therefore, a substance with 1.7 g per $cm^3$ has a higher density than another one with 1.7 kg per $m^3$. From A to B, the volume increased more than the mass, which lowers the density.