Act 1 is set in a chocolate house where Mirabell and Fainall have just finished playing cards. A footman comes and tells Mirabell that Waitwell (Mirabell's male servant) and Foible (Lady Wishfort's female servant) were married that morning. Mirabell tells Fainall about his love of Millamant and is encouraged to marry her. Witwoud and Petulant appear and Mirabell is informed that should Lady Wishfort marry, he will lose  6000 of Millamant's inheritance.He will only get this money if he can make Lady Wishfort consent to his and Millamant's marriage.
Act 2 is set in St. James  Park. Mrs. Fainall and Mrs. Marwood are discussing their hatred of men. Fainall appears and accuses Mrs. Marwood (with whom he is having an affair) of loving Mirabell (which she does). Meanwhile, Mrs. Fainall (Mirabell's former lover) tells Mirabell that she hates her husband, and they begin to plot to deceive Lady Wishfort into giving her consent to the marriage. Millamant appears in the park and, angry about the previous night (when Mirabell was confronted by Lady Wishfort), she tells Mirabell of her displeasure in his plan, which she only has a vague idea about. After she leaves, the newly wed servants appear and Mirabell reminds them of their roles in the plan.
Acts 3, 4 and 5 are all set in the home of Lady Wishfort. We are introduced to Lady Wishfort who is encouraged by Foible to marry the supposed Sir Rowland   Mirabell's supposed uncle   so that Mirabell will lose his inheritance. Sir Rowland is, however, Waitwell in disguise, and the plan is to entangle Lady Wishfort in a marriage which cannot go ahead, because it would be bigamy, not to mention a social disgrace (Waitwell is only a serving man, Lady Wishfort an aristocrat). Mirabell will offer to help her out of the embarrassing situation if she consents to his marriage. Later, Mrs. Fainall discusses this plan with Foible, but this is overheard by Mrs. Marwood. She later tells the plan to Fainall, who decides that he will take his wife's money and go away with Mrs. Marwood.
Mirabell and Millamant, equally strong-willed, discuss in detail the conditions under which they would accept each other in marriage (otherwise known as the "proviso scene"), showing the depth of their feeling for each other. Mirabell finally proposes to Millamant and, with Mrs. Fainall's encouragement (almost consent, as Millamant knows of their previous relations), Millamant accepts. Mirabell leaves as Lady Wishfort arrives, and she lets it be known that she wants Millamant to marry her nephew, Sir Wilfull Witwoud, who has just arrived from the countryside. Lady Wishfort later gets a letter telling her about the Sir Rowland plot. Sir Rowland takes the letter and accuses Mirabell of trying to sabotage their wedding. Lady Wishfort agrees to let Sir Rowland bring a marriage contract that night.
By Act 5, Lady Wishfort has found out the plot, and Fainall has had Waitwell arrested. Mrs. Fainall tells Foible that her previous affair with Mirabell is now public knowledge. Lady Wishfort appears with Mrs. Marwood, whom she thanks for unveiling the plot. Fainall then appears and uses the information of Mrs. Fainall's previous affair with Mirabell and Millamant's contract to marry him to blackmail Lady Wishfort, telling that she should never marry and that she is to transfer her fortune to him. Lady Wishfort offers Mirabell her consent to the marriage if he can save her fortune and honour. Mirabell calls on Waitwell who brings a contract from the time before the marriage of the Fainalls in which Mrs. Fainall gives all her property to Mirabell. This neutralises the blackmail attempts, after which Mirabell restores Mrs. Fainall's property to her possession and then is free to marry Millamant with the full  6000 inheritance.
Output: Who did Mrs. Fainall have an affair with?