In New York City, four heavily armed men with code names (Mr. Blue, Mr. Green, Mr. Grey, and Mr. Brown), wearing disguises of eyeglasses, fedora hats, and fake moustashes, board at different station stops (the Green Line at 59th Street, Grey Line at 51st Street, Brown Line at Grand Central, and finally Blue Line at 28th Street) on the Pelham 123 subway train run of the 6 Lexington Avenue Local service. The men take the train, securing a group of hostages, whom they isolate in one car of the train, then disconnect this car from the rest of the train.Meanwhile, Lieutenant Zachary Garber (Walter Matthau), a cynical and curmudgeonly yet light-hearted New York City Transit Authority police lieutenant, begins his day by leading four visiting Tokyo Metro directors on a tour of New York's subway command-center. This is interrupted by Blue's radio announcement to the command center that "your train has been taken." Blue (Robert Shaw), the British-accented leader of the hijackers, tells Garber they are demanding a ransom of one million dollars, to be delivered to them within one hour; otherwise they will kill one passenger per minute, starting when the hour has passed.Garber, the sarcastic Lieutenant Rico Patrone (Jerry Stiller), and other transit workers cooperate while trying to guess how the criminals intend to escape the subway tunnel and get away. Various clues soon surface for Garber to figure out, first with his hearing Blue's very distinctive English accent over the radio. It later turns out that Blue was a ruthless British mercenary, and Green (Martin Balsam) is a former transit worker who from time to time sneezes over the radio and is heard by Garber, who responds by saying "Gesundheit." Garber also learns that one of the hostages is an undercover police officer.The mayor finally agrees to pay the ransom at the urging of his deputy mayor. The police dispatch a squad car carrying the ransom money. When the car is wrecked in a collision, Garber daringly bluffs to buy some time, telling the takers that the money already has been delivered to the 28th Street Station and only the walk down the tunnel is delaying it. A reluctant Blue agrees to the delay.A police motorcycle completes the trip from the scene of the collision to the subway station and two unarmed officers are sent down the track on foot to deliver the money to the hijackers. With the money finally in hand, the hijackers demand that electric power be restored to the subway line, and that all signals in the path of the train be turned green from 28th Street to the South Ferry station, both of these being necessary for the car to move. Having overridden the subway car's dead-man's switch, which would otherwise ensure its stopping unless someone remained at the throttle, the hijackers get off the train and set it in motion. As the train starts to move, the undercover officer also jumps off the train and hides between the rails. The car begins to travel faster and faster, since no one is controlling its speed.Outside the tunnel, Garber and Inspector Daniels are convinced that the runaway train is a diversion and that the hijackers must have left the train.The hijackers divide the ransom money, discard their disguises, and start their escape into the tunnel's emergency exit; however, Grey refuses to leave his gun behind as agreed and is shot dead by Blue. The undercover officer, still hiding in the tracks, manages to kill Brown with one shot. Green escapes onto the street.Garber arrives after Green has gotten away and, drawing on Blue, orders him to surrender just as Blue is about to shoot the undercover officer. Blue asks Garber if the death penalty is available in the state of New York anymore. Told that it is not, Blue responds, "Pity", then promptly electrocutes himself by stepping onto the third rail while a horrified Garber watches.Entering the South Ferry Loop, the runaway car finally encounters a red signal. The car's emergency brakes are tripped and it grinds to a halt; the remaining hostages are all safe.Green, the only hijacker to escape, has left as a clue only Garber's surmise that one of the hijackers must be an ex-motorman of the New York Transit Authority (owing to the hijackers' knowledge of the car's operation). With the dead three all identified, Garber realizes that the hijacker still at large must be the former transit employee. Garber and Patrone, working their way through a list of former motormen "discharged for cause" (and, by implication, disgruntled), pay a visit to Harold Longman. Longman, known to the audience as Mr. Green, is shown rolling in the packs of ransom money on the bed in his seedy efficiency apartment when Garber and Patrone knock on his door. He hides the money quickly, then opens to the officers and bluffs his way through their questioning. The officers find Longman's alibi weak, but start out the door, until Longman sneezes and Garber says "Gesundheit." Garber then re-opens the door, the expression on his face in the door opening (the film's final frame) telling the audience that he knows he has just found the final hijacker.
Output: Question: Who does Garber and Patrone pay a visit to?, Answer: Harold Longman