脳みそを絞る(のうみそをしぼる)

Japanese vocabulary

Meaning: to rack one's brains

See it used in real works