míng​sī​kǔ​suǒ

to rack one's brains