The Prophet (ﷺ) said: When three are on a journey, they should appoint one of them as their commander.
Sunan Abi Dawud Book 15, Hadith 132