Tim: "I am a joker but Tom is a knave."
Tom: "I am not a joker but Tim is a knight."
Jim: "When Tim and I are in the same room, Tim always lies. But when Tom and I are in the same room, he tells the truth."
A knight always tells the truth, a knave always lies, and a joker just mimics anyone who is in the same room with them.
There are only 1 knight, 1 knave, and 1 joker. Tim and Tom were in the same room while Jim was outside.
If the joker is alone, he would lie.
Who is the knight?