During the American Civil War, mercenary Angel Eyes interrogates former Confederate soldier Stevens, whom Angel Eyes is contracted to kill, about Bill Carson, a fugitive who stole a cache of Confederate gold. Stevens offers Angel Eyes $1,000 to kill Baker, Angel Eyes's employer. Angel Eyes accepts the contract, and kills Stevens as he leaves. Angel Eyes returns to Baker for his fee, then shoots Baker, fulfilling his contract with Stevens.Meanwhile, Mexican bandit Tuco RamÃ­rez is rescued from three bounty hunters by "Blondie", who delivers him to the local sheriff to collect his $2,000 bounty. As Tuco is about to be hanged, Blondie severs Tuco's noose by shooting it, and sets him free. The two escape on horseback and split the bounty in a lucrative money-making scheme. Then they repeat the process, with Blondie again turning Tuco in, collecting more reward-money, and again saving Tuco from execution. But Blondie grows weary of Tuco's complaints, and abandons him penniless in the desert.Tuco survives and tracks Blondie to a town being abandoned by Confederate troops. As he prepares to kill Blondie, Union forces shell the town, allowing Blondie to escape. Following an arduous search, Tuco recaptures Blondie and force-marches him across a desert until Blondie collapses from dehydration. As Tuco prepares to shoot him, he sees a runaway carriage. Inside is a delirious Bill Carson, who promises Tuco $200,000 in Confederate gold, buried in a grave in Sad Hill Cemetery. Tuco demands to know the name on the grave, but Carson collapses from thirst and cannot answer. When Tuco returns with water, Carson has died and Blondie, slumped next to him, reveals that Carson recovered and told him the name on the grave before dying. Tuco, who now has strong motivation to keep Blondie alive, gives him water and takes him to a nearby frontier mission to recover from his thirst and exhaustion.After Blondie's recovery, the two leave in their Confederate uniforms, only to be captured by Union soldiers and remanded to the POW camp of Batterville. At roll call, Tuco answers for "Bill Carson," getting the attention of Angel Eyes, now a disguised Union sergeant at the camp. Angel Eyes tortures Tuco, who reveals the name of the cemetery, but confesses that only Blondie knows the name on the grave. Realizing that Blondie will not yield to torture, Angel Eyes offers him an equal share of the gold and a partnership. Blondie agrees and rides out with Angel Eyes and his gang. Tuco is packed on a train to be executed, but escapes.The iconic Mexican standoff, with Tuco seen on the left, Angel Eyes in the middle, and Blondie on the right. The scene is accompanied by Ennio Morricone's "The Trio".Blondie, Angel Eyes, and his henchmen arrive in an evacuated town. Tuco, having fled to the same town, takes a bath in a ramshackle hotel and is surprised by Elam, a bounty hunter searching for him. Tuco shoots Elam. Blondie investigates the gunshots and finds Tuco, and they agree to resume their old partnership. The pair kill Angel Eyes's men, but discover that Angel Eyes himself has escaped.Tuco and Blondie travel to Sad Hill, now held by Confederate troops on one side of a strategic bridge against the advancing Union troops. Blondie decides to destroy the bridge to disperse the two armies to allow access to the cemetery. As they wire the bridge with explosives, Tuco suggests they share information, in case one person dies before he can help the other. Tuco reveals the name of the cemetery, while Blondie says (lying) that name on the grave as "Arch Stanton." After the bridge explodes, the armies disperse, and Tuco steals a horse and rides to Sad Hill to claim the gold for himself. He finds Arch Stanton's grave and begins digging. Blondie arrives and encourages him at gunpoint to continue. A moment later, Angel Eyes surprises them both, also at gunpoint. Blondie opens Stanton's grave, revealing just a skeleton. Blondie states that he lied about the name on the grave, and offers to write the real name of the grave on a rock. Placing it face-down in the center place of the cemetery, he silently challenges Tuco and Angel Eyes to a three-way duel.The trio stare each other down. Everyone draws, and Blondie shoots and kills Angel Eyes, while Tuco discovers that his own gun was unloaded by Blondie the night before. Blondie reveals that the gold is actually in a grave beside Arch Stanton's, marked "Unknown." Inside are bags of gold. Tuco is initially elated, but Blondie holds him at gunpoint and orders him into a hangman's noose beneath a tree. Blondie binds Tuco's hands and forces him to stand balanced precariously atop an unsteady grave marker while Blondie takes half the gold and rides away. As Tuco screams for mercy, Blondie returns into sight. Blondie severs the rope with a rifle shot, dropping Tuco, alive but angry, onto his share of the gold. Tuco shouts abuse while Blondie rides off into the horizon.
Output: Question: what are the three men searching for in the desert?, Answer: confederate gold