The following is a sentence that can be made gramatically correct by adding punctuation and quotation marks. Can you do it?

James while John had had had had had had had had had had had a better effect on the teacher.

 

SOLUTION:

James, while John had had "had", had had "had had";
"had had" had had a better effect on the teacher.

Or, to clarify,
While John had used 'had', James had used 'had had'. The teacher had preferred 'had had'.