mind one's p's and q's - Phrases/Idioms
The American Heritage® Dictionary of Idioms by Christine Ammer. Copyright © 2003, 1997 by The Christine Ammer 1992 Trust. Published by Houghton Mifflin Harcourt Publishing Company. All rights reserved.
Practice good manners, be precise and careful in one's behavior and speech, as in Their grandmother often told the children to mind their p's and q's. The origin of this expression, first recorded in 1779, is disputed. Among the more interesting theories advanced is that bartenders kept track of customers' consumption in terms of pints (p's) and quarts (q's) and the phrase referred to an honest accounting; that schoolchildren were taught to be careful in distinguishing the letters p and q; and that French dancing masters cautioned pupils about the correct performance of the figures pieds and queues (either abbreviated or mispronounced in English as p's and q's).