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?

There are precisely four possible cases to consider:

Case 1: Both A and B are Knights

Both the responses of A and B are No.

Case 2: A is a Knight but B is a Liar.

Both the responses of A and B are Yes.

Case 3: A is the Liar while B is the Knight

A would say Yes but B would say No.

Case 4: Both A and B are liars

Both A and B would say No

We observe that only in Case-3, the responses of A and B are at variance with each other, while in the other three cases the the responses of each of A and B are in consonance with each other.

Accordingly, if Timothy had responded in the affirmative, his friend would have disregarded Case 3 as a valid choice, but, he would not have been able to reach a definitive conclusion on the matter. Therefore, in order to reach a definitive conclusion in the matter, only Case 3 must be valid, thereby eliminating the other three cases.

Consequently, it now follows that A is the Liar while B is the Knight.

Nice problem.