Two constant-pressure devices, each filled with $30 \mathrm{~kg}$ of air, have temperatures of $900 \mathrm{~K}$ and $300 \mathrm{~K}$. A heat engine placed between the two devices extracts heat from the hightemperature device, produces work, and rejects heat to the low-temperature device. Determine the maximum work that can be produced by the heat engine and the final temperatures of the devices. Assume constant specific heats at room temperature.