Problem #PRU-64646

Problems Set theory and logic Mathematical logic Mathematical logic (other)

Problem

Ali Baba followed by 40 robbers lined up on the crossing across the Bosporus Strait. There is only one boat and in it there can be either two or three people (there cannot be one person in the boat). Among those in the boat there should not be people who are not friends with each other. Will all of them be able to cross, if every two people standing next to each other in the queue are friends, while Ali Baba is also friends with the robber standing behind the person next to him?