Answer: gas < liquid < solid
Explanation: The most common situation is described:
Solids have the particles very close to each other, this is the reason they conserve the shape.
Liquids have the particles close to each other, but not as much as a solid, the liquids lose their shape but stay together as a homogeneous mass.
Gases have the particles more spread than in the liquid, this is why gases don't even have a shape or homogeneous mass.
On the other hand, the density is calculated as mass over volume, we also can write this as the number of particles in a determined volume, under this viewpoint, it is easy to expect that the densest will be the solids, then liquids and lastly the gasses.
so the solution is: gas < liquid < solid
Something cool to notice is that this is not always true, for example in the case of water, the solid-state of water (ice) is less dense than the liquid water at low temperatures.