Mind One’s P’s and Q’s

What does the idiom “Mind One’s P’s and Q’s” mean?


Be attentive to details; be on one’s best behavior

For example:

“When you’re working on this project, mind your p’s and q’s. There are a lot of places where it’s easy to make a mistake.”


This is said to have arisen in the world of typesetting, where the letters p and q were easily confused.