The first person cannot be telling the truth since if all the others are knaves, this contradicts that they are telling the truth when they say the person in front is a knave.
The second person says the first is a knave so is telling the truth; he is a knight.
The third says this knight is a knave so he is lying; he is a knave. Continuing in this way we see that there is an alternating sequence of 13 knaves and 12 knights.
This problem is taken from the UKMT Mathematical Challenges.