A group of 25 people consists of knights, knaves and liars. Each person was asked "Are you a
knight?", and 17 responded yes. Each person was then asked "Are you a knave?", and 12 responded yes.
And finally each person was asked "are you a liar?", and 8 responded yes.
How many knights, knaves and liars are in the group?
Let A be the number of knights, B the number of truth-first knaves, C the number of lie-first knaves, and D the number of liars.
A knight answers [yes,no,no]
A truth-first knave answers [no,no,no]
A lie-first knave answers [yes,yes,yes]
A liar answers [yes, yes, no]
We have
A+B+C+D = 25 (total number of people)
A+C+D = 17 (people answering 'yes' to the first question)
C+D = 12 (people answering 'yes' to the second question)
C = 8 (people answering 'yes' to the third question)
Solving this gives
A = 5 knights
B+C = 8+8 =16 knaves
D = 4 liars