We've all been there: One minute, a seemingly innocuous upbeat tune is playing on the radio. The next, that shamefully catchy chorus has lodged itself in your brain, burrowing deeper and deeper, intent on playing endlessly — over and over and over and over — until you feel as if you're about to descend into madness.

Little is understood about what exactly triggers these irritating earworms. But researchers at the University of Western Washington have some tips on how to get that annoyingly catchy song out of your head. The best solution? Keep your short-term memory occupied with brain-teasers like anagrams.

In the study, researchers induced earworms by playing catchy songs by artists like Lady Gaga and ABBA while they had participants draw their way through mazes. (For whatever reason, doing a maze helped the song "stick.") They then gave participants anagrams, Sudoku puzzles, and novels to occupy themselves with in an attempt to reduce the reoccurrence of the earworms. The researchers found that anagrams were the most successful at getting songs out of participants' heads, while Sudoku and even reading helped to some degree. 

"The key is to find something that will give the right level of challenge," said Dr. Ira Hyman, a researcher Western Washington University. "If you are cognitively engaged, it limits the ability of intrusive songs to enter your head." Since songs often get stuck in our heads when we're doing things like driving or walking that don't require all of our cognitive resources, the best way to banish a tune from your memory is by occupying that extra space with another activity. Just don't overcompensate and break out the Proust or extra-hard Sudokus — tasks that are too difficult can also cause the mind to wander.