The famous Singapore Detective, Nguyen Bao, was on vacation in the remote country of Proth. Proth is a country where the population follows the rules of Knights, Knaves, Liars, Squires and Pages. Knights always tell the truth. Knaves strictly alternate between truths and lies. Liars always lie. Squires, trying to impress people, copy the last person who made a statement, by following that person’s lie with a lie, or that person’s truth with a truth. Pages, trying to irritate people, do the opposite of the last person who made a statement, by following that person’s truth with a lie, or their lie with a truth.

As it turned out, while enjoying his vacation, Detective Nguyen was asked to give his insights into a local crime. Sometime the previous evening, the Magistrate’s Custard Pudding had disappeared. There were five people who had access to the Pudding. One or more of them could have perpetrated the crime, but the local police were baffled and were unable to crack the case.

Prior to questioning the suspects, Detective Nguyen asked the constable to have the five suspects assembled into an interrogation room. Realizing that he could not trust the constable to provide any truthful insight into the case, Detective Nguyen entered the room alone, and took a seat.

Hoping to find a suspect who would help, Detective Nguyen asked, "Who here is a Squire?"

A: "B is not a Squire."
B: "C is not a Squire."
C: "E is not a Squire."
D: "A is not a Squire."
E: "D is not a Squire."

Seeing a possible flaw with his tactic, Detective Nguyen then asked, "Who here is a Knight?"

B: "I am a Knight."
E: "I am a Knight."
C: "I am a Knight."
A: "I am a Knight."
D: "I am a Knight."

With a sense of frustration, Detective Nguyen quickly asked, "Who stole the Custard?"

C: "I didn’t do it."
B: "I didn’t do it."
D: "I didn’t do it."
A: "I didn’t do it."
E: "I didn’t do it."

Detective Nguyen took a breath. After a brief pause he asked, "How many of you were involved?"

D: "Only one of us did it."
A: "Only two of us did it."
C: "Only three of us did it."
E: "Only four of us did it."
B: "All of us did it."

Thinking to himself that perhaps there was a chance to solve this, Detective Nguyen asked, "Who did it?"

E: "B did it."
B: "D did it."
D: "A did it."
C: "E did it."
A: "C did it."

Standing up, Detective Nguyen left the room and made his report to the Magistrate.

What trait did each suspect exhibit, and who ate the pudding?

Let A1 be A's first statement, A2 be A's second statement, and so on. Suppose A1 is false. Then, B is a squire. Then, B1 is a lie, so C is a squire. Then, C1 is also false, which makes E a squire. Since B2 is false and B is a squire, E1 is false, so D is a squire. That means that D1 is false, so A is a squire. Since they are all squires, every statement is false. All the third statements are false, so they are all guilty, but all the fifth statements being false make them all innocent. Therefore, A1 is true, so A is not a liar and B is not a squire.

Suppose B1 is false. Then, for the same reasons as before, A, C, D, and E are all squires. That implies that D4-E4 are either all true or all false. They cannot all be true, so they are all false. Therefore, they are either all innocent or all guilty. Since D is a squire, E3 is false, so they are all guilty. Then, B3 is false, so B2 is false. Also B4 is true. Therefore, B is neither a knight, a knave, nor a liar. Since C3 and B3 are both false, B is a squire. However, E4 is false and B4 is true. That is a paradox, so B1 is true. Therefore, B is not a liar and C is not a squire.

Since A1 and B1 are both true, B is not a page. Also, B3 and B4 contradict, so B is not a knight. Therefore, B is a knave. Since B is a knave, B3 and B5 are both true. Therefore, B is innocent and D is guilty.

Suppose A is a knave. Then, A3 and A5 are both true, so A is innocent and C is guilty. If E is innocent, then 2 are guilty, so A4 is true. However, A is a knave, so A4 is false and E is guilty. Then, C3 is false and C5 is true, so C is either a page or a squire. Since D5 is false, C is a page. That makes D2 true, so D is a knight. However, D5 is false, so D cannot be a knight. Therefore, A is not a knave.

Suppose A is a page. Since A2 is false, C2 is true, so C is a knight. Then, C3 and C4 are true, so 3 people did it, but not C. Since A is a page, one of D3 and A3 is true and one is false, so either D or A is innocent. We know that D is guilty, so A is innocent. We also know that B is innocent. However, A, B, and C are all innocent, so 3 people cannot be guilty. Therefore, A is not a page.

Suppose A is a squire. Since D3 is false, A3 is true, so A did it. Since A is a squire, D4 and A4 are either both true or both false. They cannot both be true, so they are both false. Also, C5 and A5 are either both true or both false. If they are both false, then only A and D are guilty, making A4 true. Therefore, they are both true, so B is the only innocent one. Then, E3 is false, so E2 is false. Since E2 is false and E4 is true, E is either a page or a squire. B2 and E2 are both false, so E is a squire. However, C4 is false and E4 is true, so E is not a squire. That is impossible. Therefore, A is not a squire, so A is a knight.

Since A is a knight, A4 is true, so 2 people did it. Also, A5 is true, so C is guilty. Therefore, the guilty ones are C and D. D1 is true and D3 is false, so D has to either be a page or a squire. Since B3 is true and D3 is false, D is a page. Since E3 is true and E5 is false, E is either a page or a squire. D1 and E1 are both true, so E is a squire. All of C's statements are lies, so C is neither a knight nor a knave. We also know that C is not a squire. Since E2 and C2 are both false, C is not a page. Therefore, C is a liar.