Task: Question Generation
Input (English):  In October 1973, "Control", head of British intelligence ("the Circus"), sends agent Jim Prideaux to Budapest to meet a Hungarian general wishing to defect. Prideaux is shot and captured. Amid the international incident that follows, Control and his right-hand man George Smiley are forced into retirement. Control dies of illness.
Percy Alleline becomes the new Chief, with Bill Haydon as his deputy, and Roy Bland and Toby Esterhase as key lieutenants. Despite Control and Smiley's misgivings, their successors had already begun a secret operation "Witchcraft" to obtain Soviet intelligence, which is being exchanged with the CIA for US intelligence.
Smiley is brought out of retirement by Oliver Lacon, the civil servant in charge of intelligence, to investigate a claim by Ricki Tarr, a British spy, that there has been a long-term mole in a senior role in the Circus, as Control had suspected. Smiley chooses a trustworthy agent, Peter Guillam, and retired Special Branch officer Mendel to help him. He interviews Connie Sachs, who was sacked by Alleline after deducing that Alexei Polyakov, a Soviet cultural attach  in London, was a spy.
Tarr tells Smiley that, on a mission to Istanbul, he had had an affair with Irina, a Soviet agent. She wanted to reveal the name of a mole in the top ranks of the Circus, but when Tarr reported this to London, they ignored him and ordered him straight home, whereas Moscow immediately kidnapped Irina. Tarr concluded that the mole had intercepted his message, and went into hiding, suspected of defecting and murdering the British station chief. Smiley sends Guillam to steal the Circus logbook for the night Tarr called: he finds the pages for that night are cut out, suggesting that Tarr's story is true.
Smiley interviews Prideaux, who after brutal interrogation was exchanged by the Soviets but sacked from the service. Prideaux says the purpose of the mission to Hungary was to get the name of the mole. Control had codenamed the suspects "Tinker" (Alleline), "Tailor" (Haydon), "Soldier" (Bland), "Poorman" (Esterhase), and "Beggarman" (Smiley himself).
Smiley learns that Alleline, Haydon, Bland, and Esterhase have been meeting Polyakov the "Witchcraft" source at a safe house, where Polyakov gives them supposedly high-grade Soviet intelligence in exchange for low-grade British material, to help him maintain his cover with the Soviets. However, the mole is passing substantive material, including US intelligence, to Polyakov, his handler, whilst Polyakov's material has just enough substance to persuade the CIA to share information with the British.
Smiley blackmails the location of the safe house out of Esterhase, whose exile status makes him vulnerable to deportation. Smiley then has Tarr appear at the Paris office, implying he knows who the mole is. The mole meets Polyakov at the safe house, where Smiley arrests him: he is Bill Haydon.
The Circus plans to exchange Haydon with the Soviets, but he is killed by Prideaux, who was implied to have been Haydon's lover and betrayed by him in the Budapest incident. Smiley returns to the Circus as its new chief.
Output (English): Who did Tarr have an affair with?