On an island every inhabitant is either a knight, who always tells the truth, or a knave, who always lies. You meet four inhabitants, A, B, C and D.

A says: "D and I are of the same kind."
B says: "Exactly one of us four is a knight."
C says: "A and I are of the same kind."
D says: "Exactly three of us four are knights."

Which of A, B, C and D are knights and which are knaves? Show the reasoning that rules out every other assignment.
