Timothy once visited a land of knights and liars,and met two inhabitants,A and B.
He had the following conversation.
Timothy:A,is B a liar?
Timothy hears A's answer,but he will not tell you what it was.
Timothy:B,are you both liars?
Timothy hears B's answer,but he will not tell you what it was.
At this point,I will not tell you whether or not he knew what they were.
He once told his friend what questions he asked,but not what answers he got.
The friend did not have enough information,so the following dialogue occurred.
Friend:Were your answers the same?
Timothy's friend hears his answer,and finally the friend has enough information to solve what A and B are.
What are they?
We know that the answers given by A and B are in Yes-No form only.
So now, suppose that when Tim asked B if both of them were Liars, B answered No.Then either both A and B are Knights or A is a Liar and B is a Knight.
If now both of them are Knights, then even A answers No when Tim asks him if B is a Liar. So here he is getting both same answers (both No).
Now, if A is a Liar and B is a Knight, then A answers Yes when Tim asks him if B is a Liar. So, in this case Tim gets two different answers (Yes from A and No from B).
Next, let us assume that B answers Yes when he is asked if both of them are Liars. Then here we have only one combination and that is A is a Knight and B is a Liar and so A's answer will be Yes when Tim asks him if B is a Liar. So here once again Tim gets two same answers (both Yes).
From the above arguments we see that the only two different answers that Tim can get from A and B is a Yes from A and a No from B and in that case, we see that A is a Liar and B is a Knight.
But we see that there are two cases when Tim gets same answers from both A and B (either both Yes or both No).
If both the answers are No, then both A and B are Knights.
If both the answers are Yes, then A is a Knight and B is a Liar.
Suppose that when Tim's friend asked him (Tim) if both the answers were same and Tim replied Yes, then Tim's friend still wouldn't be able to determine what each of A and B were (for sure), since he would then be left out with two possibilities.
But since there is only one combination for two different answers, from which Tim's friend can easily determine what each of A and B are and actually does so, as the problem says: "Timothy's friend hears his answer,and finally the friend has enough information to solve what A and B are", so obviously Tim's answer was No, that is, the answers were not the same and therefore, we can conclude that:
A is a KNIGHT
B is a LIAR