p pint
q quart
There are 2 pints in a quart
When sailors would run a tab at a bar the bartender would record each pint and quart that a sailor would consume. Then when the sailor would get paid he would settle his tab with the bartender.
If a sailor was drunk the bartender could record a q instead of a p and the sailor would get screwed over if he signed a tab where he didn't mind his p's and q's.