You have been sent to a remote island to negotiate a trade agreement. Three representatives arrive in a limo to greet you at the airport. The island is divided into three social castes: knight, cannibal, and knave, from highest to lowest. Knights always tell the truth, knaves always lie, and cannibals are equally as likely to tell the truth or lie with any utterance. You know that the contingent sent to meet you consists of exactly one of each, but it is impossible to tell them apart from physical appearance alone.
Under no circumstances would your homeland conduct business with a cannibal, because someone will get eaten over the most inconsequential dispute. During the limo ride to the hotel, you are allowed to ask only one person one binary question (that can be answered with a simple yes/no), and it should give you enough information to stay away from the cannibal, guaranteed. What do you ask?
Let's designate one representative each as A, B, C. Regardless of how we designate, there are six possible alignments as follows:
A – knight, B – cannibal, C – knave
A – knight, B – knave, C – cannibal
A – cannibal, B – knight, C – knave
A – cannibal, B – knave, C – knight
A – knave, B – knight, C – cannibal
A – knave, B – cannibal, C – knight
You ask A, “Is B higher ranked than C?” If the answer is yes, open negotiations with C; otherwise, choose B.
If A responds “yes”, either he is telling the truth (he is a knight), which also requires that B is a cannibal and thus higher ranked than C, a knave; or he is lying (he is a knave), which also requires that B is a cannibal and thus lower ranked than C, a knight. If A is a cannibal, the case is closed; in either case, C is definitely not a cannibal.
Similarly if A responds “no”, either he is telling the truth (he is a knight), which also requires that B is a knave and thus lower ranked than C, a cannibal; or he is lying (he is a knave), which requires that B is a knight and thus higher ranked than C, a cannibal. Again, if A is a cannibal, the case is closed; in either case, B is definitely not a cannibal.