míng​sī​kǔ​xiǎng

to rack one's brains