Well, I don\'t know if it would be strictly necessary, but it would certailny be more efficient.
If the gills were in the lungs, they\'d have to have
very powerful muscles to squeeze the water out and suck new water in rapidly to fulfill the oxygen requirements, especially when swimming fast.
Gills, on the contrary, are a streaming system, i.e., there is an almost constant flow of water through them, in only one direction (not reversed as with lungs). This can of course have a higher throughput with considerably less effort, which would make it way more efficient.
However, both systems could share the same space. For both oxygen carriers (water and air), it\'d be less efficient than a specialised system for each, but still much better than a cycling system like lungs for water. A specialised system wouldn\'t be good due to the extra space and weight it\'d require, which would create more problems for both flight and swimming.
Therefore, I\'d say they have lungs that are gills, so that they operate depending on the element they\'re in. If in air, the gill-outlets close, enabling normal lung-operation. In water, they open and the water is being streamed through (nose/mouth -> lungs -> outlets).
For this to work, I\'d envision the gill-outlets to be somewhere between the ribs (probably at the left and right sides of the torso).
It might also be required to increase the diameter of the breathing channel in the nose, head and throut to allow water to pass through more easily (because of it\'s higher viscosity, for the same diameter, considerably more pressure is required to get the same volume of water through than air, therefore requiring more effort, making it inefficient unless the pipe diameter is increased to let the water flow more easily.) The increase won\'t hurt for air. You could also have additional inlet-openings at the throat to not require a giant nose.

These would also only open when in water.