Brooklyn Nine-Nine 4x05
Gina Linetti (Chelsea Peretti) is all smiles on ‘Brooklyn Nine-Nine’ season 4, episode 5. Fox/Brooklyn Nine-Nine Official Facebook Page

The Nine-Nine precinct holds its fourth annual Halloween heist competition to determine who wins the title of “Ultimate Detective/Genius” on “Brooklyn Nine-Nine” season 4, episode 5 (Brooklyn Nine-Nine 4x05).

Spoiler alert: This recap contains plot details about season 4 of “Brooklyn Nine-Nine.” The fourth season premiered Sept. 20 on Fox US. Season 3 is available on Netflix Australia.

The prize of this year’ Halloween heist is a plaque that reads “The Ultimate Detective/Genius.” Whoever possesses the plaque before the deadline hits wins the competition.

Jake Peralta (Andy Samberg) puts the plaque inside his girlfriend Amy Santiago’s (Melissa Fumero) pink childhood caboodle and places it in the middle of the precinct. The main participants -- Peralta, Santiago and Captain Holt (Andre Braugher) -- then pick their respective partners.

Sergeant Terry Jeffords (Terry Crews) chooses not to join any team, refusing to participate in what he calls a “dumb” event. Peralta orders Norman Scully (Joel McKinnon Miller) and Michael Hitchcock (Dirk Blocker) to follow Jeffords and see if the sergeant plans to win the competition secretly on his own.

Peralta is surprised when Holt picks Charles Boyle (Joe Lo Truglio), Peralta’s best friend, as partner. Peralta has planned to use Boyle and a body double to help himself win. In retaliation, Peralta chooses Holt’s assistant, Gina Linetti (Chelsea Peretti), as his partner.

Peralta uses the body double to look like Linetti as a distraction, while the real Linetti secretly locks the other teams in their rooms. Peralta attempts to recover the plaque inside the caboodle when Holt breaks his own office window to stop him. Peralta hands over the plaque to the roller-skating Linetti, but she hits a wall, losing a couple of front teeth. She leaves the precinct and goes to see a dentist.

The game is restarted, but before the teams could make their moves, the plaque gets stolen. The participants accuse Jeffords of stealing the plaque but the culprit is actually Rosa Diaz (Stephanie Beatriz), Santiago’s partner. They stash the plaque inside the women’s restroom, but Holt sends his trained dog to retrieve it. Peralta eventually takes the plaque for himself after forcing Boyle to reveal its hiding place. Holt tells Peralta that he knew Boyle would eventually give in, so he hid the plaque in a different spot.

The main participants are surprised when they learn that each of them has their own plaque. They go to Jeffords and accuse him of orchestrating the whole fiasco. Jeffords denies any involvement and knowledge related to the real plaque. Linetti then appears before the lot and confesses that she set up the whole thing, including manipulating Holt to choose Boyle and misleading the squad to suspect Jeffords.

Linetti wins the annual heist but changes the title to “The Ultimate Human/Genius,” being only an assistant and not an actual police officer.