If traveling by plane is necessary and the cases you mentioned are inevitable, you should choose the case which involves less Fitnah (temptation) based on the rule of applying the lesser of two harms or evils. Additionally,
you should lower your gaze as much as possible. However, if traveling by plane is not necessary and you have other alternatives, you should avoid that to guard your faith. (Part No. 26; Page No. 341) May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.