Infernal Affairs focuses on a police officer named Chen Wing-Yan (Tony Leung Chiu-Wai), who goes deep undercover into the Triad society, and Triad member Lau Kin-Ming (Andy Lau Tak-Wah), who infiltrates the police department. Each mole was planted by the rival organization to gain an advantage in intelligence over the other side. The more the moles become involved in their undercover lives, the more issues they have to cope with.The Prologue opens with the introduction of Hon Sam (Eric Tsang Chi-Wai), a Triad boss and the primary antagonist of the film. Sam is sending a number of young, green gangsters to the police academy as molesamongst them is one called Lau Kin-Ming (whose younger version is portrayed by Edison Chen Koon-Hei). At the same time another person named Chen Wing-Yan (whose younger version is portrayed by Shawn Yue Man-Lok) is shown joining the police force. Although he manages to impress the Superintendent Wong Chi-Shing (Anthony Wong Chau-Sang) and the police academy principal Yip, Yan is expelled from the academy. In reality Yan becomes an undercover reporting directly to only Wong and Yip. Yan's undercover job becomes stressful while Ming quickly climbs the ladder in the police department.The film begins after Yan and Ming converse at a hi-fi store where Yan works, neither of them knowing who the other is. Soon after, Yan attends a funeral. It is revealed that Yip has recently died and that Superintendent Wong remains as the only person who could identify Yan as a cop. Later a deal between Hon Sam and a Thai cocaine dealer is interrupted by Superintendent Wong and his team due to Yan's tip-off using Morse Code. However, Ming alerted Sam of the bust with enough time for Sam to order his minions Tsui Wai-Keung (Chapman To Man-Chat) and Del Piero (Dion Lam Dik-On) to dispose of the cocaine so the police would not have any real evidence on the drug deal. Now, both Wong and Sam realize that they each have a mole within their respective organizations, putting them in a race against time to root out the other mole.Later, Sam converses with Ming at a cinema with Yan watching. As Sam and Ming leave, Yan tries to follow Ming. At the crucial moment, Yan's phone rings and he is forced to back off, thus losing his chance to capture Ming.At the same time, Yan and Ming are both struggling with their double identities. Yan is starting to lose faith in himself as a cop after being a gangster for ten years; while Ming, on the other hand, becomes more and more used to the life of a righteous police officer and wants to erase his criminal background.Yan meets SP Wong a second time on the same rooftop unaware that Ming has his subordinate, CIB Inspector B (Gordon Lam Ka-Tung) and his team tracking him down. Sam, after getting intel from Ming, sends Keung, Del Piero and a gang of henchmen to confront them. Inspector B informs Ming and he sends an OCTB squad to attempt to save Wong. Yan eventually escapes the building by taking the crane but Wong is caught by Del Piero and is thrown off the roof. As Yan is about to escape, he witnesses Wong's fall to death, and is stunned. As the police close in, a shootout between the police and Triads breaks out, resulting in the death of 3 Triads, one of whom is Del Piero. In the aftermath of the gunfight, the OCTB squad arrives with Ming and Wong's second-in-command Inspector Cheung (Berg Ng Ting-Yip) on the scene, but they are too late to save Wong. Yan and Keung manage to escape from the gunfight. As Keung drives away with Yan, he crashes the car, and finding that he is wounded from the gun battle, Keung dies in Yan's arms.Eventually, Ming retrieves Wong's old cellphone and makes contact with Yan. They reach a deal to foil another one of Sam's drug deals. Inspector Cheung does not want to cooperate with the operation at first because of Wong's death, but he is later convinced by Ming to go ahead with the operation. With Yan's help, Sam's drug deal is interrupted and Sam is killed by Ming. Many of Sam's other gangsters are arrested. Everything seems to work according to the plan: Yan could now return to his true identity as a police officer and Ming has successfully erased his criminal connections by eradicating Sam and his gangs. However, back at the police station, Yan discovers Ming was the mole, and leaves immediately. Ming realizes what has happened, and erases Yan's identity from the police computer records. Yan spends an evening with his therapist Lee (Kelly Chen), whom he was falling in love with, and sends a compact disc to Ming which is inadvertently intercepted by his wife Mary (Sammi Cheng Sau-Man) with a recording that Sam kept between himself and Ming. The two agree to meet on the rooftop of the building where Wong was murdered earlier. Yan disarms Ming without resistance. Yan holds a gun to Ming's head as rebuke and as reply to Ming's plea for forgiveness to remain a policeman. Inspector B arrives on the scene shortly afterwards and commands Yan to release his boss.The film ends with Yan entering a lift backwards with Ming hostage, when he is suddenly shot in the head and killed by Inspector B as he moved his head from behind Ming. Inspector B reveals that he was also a mole for Sam. He asks Ming to watch out for him, since their boss is already dead. As he and Ming enter the lift going down to the lobby, Ming shoots Inspector B dead, likely out of his desire to eradicate traces of his past and become a "good guy" police officer.The original ending climaxes with Ming identifying himself to the police as an officer, and paying homage to Yan at his funeral, where he is buried next to Superintendent Wong. Inspector Cheung and Dr Lee are present as well. A flashback reaffirms the point that Ming wished he had taken a different route in his life.Alternate EndingThe alternate ending has Ming exit the lift to be informed by Inspector Cheung that the police force have found evidence that he was a mole. He hands them his badge and is arrested without protest.
Output: Question: where was Wong killed?, Answer: Thrown off the rooftop of a building.