CHEFEXQ - O(NQ) solution in PyPy.

Things like these hurt during a contest!