You can make the following into grammatically correct English merely by adding punctuation. You may not change the word order, nor add or subtract any words.
John while Jim had had had had had had had had had had had a better effect on the teacher
Need a hint? Or perhaps you want to check the solution.