Both contract
Reason — During inspiration the diaphragm contracts and moves downward, increasing the vertical space in the thoracic cavity. The external intercostal muscles also contract, pulling the ribs upward and outward, increasing the volume of the chest cavity. This increases the thoracic volume and reduces pressure, allowing air to flow into the lungs.