Beat one’s brains out

To work very hard (to do something).

We beat our brains out in order to think of a name for the printing house.