There were once three apprentices who agreed to always travel and work together. When their masters had no more work, they became destitute. Deciding to travel once more, they agreed to separate if they found no work, but to keep in touch through an innkeeper.
On the road, they met a richly dressed man who offered them wealth and lordship if they followed his instructions. One apprentice noticed the man had one horse's foot and one man's foot, revealing him as the Devil. The Devil assured them he sought not their souls, but another's. He gave them a rule: to answer any question only with specific phrases in turn—"All three of us," "For money," and "And quite right too!"—and to say nothing more. If they obeyed, their pockets would always be full; if not, their money would vanish. He gave them a large sum and directed them to a specific inn.
At the inn, they followed the rule perfectly, confusing the innkeeper and other lodgers, who thought them mad. A wealthy merchant, fearing the "crazy" apprentices, asked the innkeeper to safeguard his gold. That night, the innkeeper and his wife murdered the merchant for his gold and framed the three apprentices.
When questioned, the apprentices could only reply with their assigned phrases, which sounded like a full confession. They were arrested, tried, and sentenced to death. On the scaffold, a grand coach arrived. The Devil, disguised as a nobleman, granted a "pardon" and allowed the apprentices to speak. The eldest revealed the innkeeper as the true murderer and directed the authorities to the cellar, where evidence of his previous victims was found. The innkeeper was executed.
The Devil then explained he had obtained the soul he wanted (the innkeeper's) and left the three apprentices free and wealthy for life.