← Back to puzzles

013 Do Androids Dream of Emmentaler Cheese?

Worker androids from the off-world colonies have made their way onto Earth. Your job is to track them down, but it's difficult — they look identical to humans. Usually you have a machine that can identify androids, but it's currently out of order.

However, your boss has devised an interim solution: Since the off-world colonies lack human food, you can quiz android suspects about specific ingredients, then ask whether they like foods containing those ingredients. A human would answer consistently, but androids who have never tasted human food may answer inconsistently. For example, if the suspect dislikes tomatoes, you'd expect them to dislike pizza as well. You have reservations about this approach, but your boss assures you it's foolproof.

Given a set of dishes and their ingredients, your task is to write a program that detects inconsistencies in the suspect's answers.

You can assume that the suspect will be asked about each dish or ingredient at most once.

The dishes and their ingredients are:

The input contains question-answer pairs of the form FOOD,ANSWER, where FOOD is a dish or ingredient and ANSWER is "yes" or "no". A newline separates each pair. If any inconsistencies are detected, output "ANDROID". Otherwise, output "HUMAN".

For example, given the input:

Pizza,Yes
Egg,No
Tomatoes,Yes
Cheese,Yes
Eggs Benedict,No

Your program should output: HUMAN

Since the suspect likes pizza, you'd expect them to like all its ingredients (tomatoes, cheese, and bread). They do say they like tomatoes and cheese, and haven't stated they dislike bread, so no conflict exists. The suspect dislikes egg and Eggs Benedict, but since Eggs Benedict contains egg that's consistent.

However, if the input was:

Pizza,Yes
Tomatoes,No

Your program should output: ANDROID

The suspect likes pizza, but dislikes tomatoes — which is an ingredient of pizza. This is inconsistent.

Another example: Given the input:

Bolognese,No
Beef,Yes
Bread,Yes
Hamburger,No
Tomatoes,Yes
Pasta,Yes

Your program should output: ANDROID

A final example: Given the input:

Carbonara,Yes
Cheese,Yes
Pasta,Yes
Egg,Yes
Bolognese,No
Ham,Yes
Beef,No

Your program should output: HUMAN

Finally, a question for you: You're in the middle of dessert, and you flip a tortilla over. Why is that?