James while John had had had had had had had had had had had a better effect on the teacher.
Фраза становится намного понятнее при добавлении в неё правильных знаков препинания:
James, while John had had «had», had had «had had»; «had had» had had a better effect on the teacher.
Примерный перевод на русский язык:
В то время, как Джон использовал «had», Джеймс использовал «had had»; учитель предпочёл «had had».
Статья в педивикии