How can the law of superposition be applied to determine the relative ages of fossils in different rock layers?