exercise 3.21 print-queue