The Prisoner of Benda

"The Prisoner of Benda" is the ninety-eighth episode of Futurama, the tenth of the sixth production season and the seventh broadcast season.

The story
A revolutionary invention allows the crew members to exchange minds, but it goes haywire and it's up to Farnsworth and the Globetrotters to fix it. According to David X. Cohen, writer Ken Keeler penned a theorem (and proof thereof) based on group theory, then used it to explain a plot twist in this episode.

Production
Writer Eric Rogers calls The Prisoner of Benda his favorite Futurama episode alongside "Jurassic Bark", "because it may be the epitome of what this series attempts to do every week: the perfect blend of science fiction and bust-a-gut humor".