Infernal Affairs focuses on a police officer named Chen Wing-yan, who goes undercover into a triad, and a triad member Lau Kin-ming, who infiltrates the Hong Kong Police Force. Each mole has been planted by the rival organisation 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 triad boss Hon Sam, who sends a number of young gangsters to the police academy as moles, among whom include a young Lau. Concurrently, a young Chen joins the police force but is seemingly expelled from the academy even though he manages to impress Superintendent Wong Chi-shing. In reality, Chen has become an undercover agent reporting only to Wong. Over the course of ten years, Chen experiences great stress from his undercover work while Lau quickly rises through the ranks in the police department. The film begins with a meeting between Chen and Lau in a hi-fi store without either of them knowing the other's identity.Wong and his team interrupt a deal between Hon Sam and a Thai cocaine dealer after receiving a tip-off from Chen using Morse code. However, Lau alerts Hon, giving him enough time to order his minions to dispose of the cocaine, eliminating solid evidence of the drug deal. After the incident, Wong and Hon are both aware that they each have a mole within their respective organisations, placing them in a race against time to root out the other mole. Later, Chen sees Hon conversing with Lau at a cinema but does not see Lau's face clearly; he ultimately fails to capture Lau. By this time, both Chen and Lau are struggling with their double identities â Chen starts losing faith in himself as a cop after being a gangster for ten years; Lau becomes more accustomed to the life of a police officer and he wants to erase his criminal background.At their next meeting, Wong intends to pull Chen out of undercover work for fear of his safety. They are unaware that Lau has his subordinate, CIB Inspector B, tracking him. Meanwhile, Hon sends "Crazy" Keung and other henchmen to confront them after receiving intel from Lau. Inspector B informs Lau and sends an OCTB squad to save Wong. Chen flees from the building using a crane while Wong sacrifices himself to save him by distracting Hon's men. Wong is beaten and thrown off the roof by the gangsters. As the police close in, a shootout ensues in which several gangsters are killed. Keung drives Chen away from the scene, but later dies from a mortal gunshot wound. It is reported on the news that Keung himself was an undercover cop; Hon assumes that he was the mole and that Chen killed him to protect the triad.Lau retrieves Wong's cell phone and contacts Chen, with both of them agreeing to foil a drug deal by Hon. The plan succeeds and many of Hon's men are arrested, while Lau betrays Hon and kills him. Everything seems to have returned to normal â Chen can revert to his true identity as a cop, while Lau has erased his criminal connections by eliminating Hon's triad. However, back at police headquarters, Chen discovers that Lau was the mole and leaves immediately. Lau, realising what has happened, erases Chen's file from the police database. Chen spends an evening with his therapist, Dr. Lee Sum-yee, with whom he has fallen in love. He sends to Lau a compact disc with a recording that Hon kept between himself and Lau; the disc is inadvertently intercepted by Lau's girlfriend, Mary.Chen and Lau meet on the same rooftop where Wong was killed earlier. Chen disarms Lau without resistance and holds a gun to Lau's head, as a rebuke to Lau's plea for forgiveness and request to remain as a cop. Inspector B arrives on the scene shortly and orders Chen to release Lau. Chen holds Lau as a hostage at gunpoint and backs into an elevator, but upon moving his head from behind Lau he is suddenly shot in the head by B. B then reveals to Lau that he is also a mole planted by Hon. As they take the lift down to the lobby, Lau kills B out of his desire to eradicate traces of his past, become a "good guy" cop, and end the mole hunt.The original ending climaxes with Lau identifying himself to the police as one of them. Lee discovers records revealing Chen as the undercover officer; B is blamed of being the mole within the force and the case is closed. Lau salutes Chen at his funeral, with Cheung and Lee present as well. A flashback reaffirms the point that Lau wished he had taken a different route in life. In mainland China, an alternate ending for the film was created, in which Lau exits the elevator and is informed by Cheung that the police have found evidence that he was a mole. Lau hands them his badge and is arrested without protest. The sequel, Infernal Affairs III, uses the original ending instead of the alternate one.
Output: Question: Where was the alternate ending for the film created?, Answer: China