A merchant's wife has an affair. One day her lover gets into a fight and is thrown in prison, so she puts on her most beautiful clothes and goes to have him freed, saying that he is her brother. She has to petition the magistrate (Wali) for his freedom and arranges for the lovestruck Wali to visit her house that night. She repeats this process with the Kazi (Qadi), Vizier, and King. Finally, she has a carpenter make a cabinet with five separate locking compartments, dyes four different gowns, and prepares a meal.
The Kazi arrives first and she has him put on a gown. They hear a tapping at the door, she says it's her husband and hides the Kazi in one of the compartments. It is actually the Wali, whom she has write a letter of pardon for her "brother." She has him put on the second gown. Then there is another knock, and she says it's her husband and puts him into the second compartment. This happens with the Vizier and the King as well. Finally the carpenter arrives and she tells him there's a problem with the top compartment. He climbs into it to prove it's all right, and she immediately closes it, goes out, frees her lover, and leaves the city with him. The five men remain trapped in the cabinet for three days until the neighbors hear their voices and let them out, revealing them all in the clothes the woman gave them.