Implementing an abstract data type with a compound structure: a line by urgency, as an array of queues — exercise

Did you try it yourself yet?האם כבר ניסיתם לפתור בעצמכם?

Trying first, even if it fails, lets the exercise teach you. Show the solution now?לנסות לפני צפייה בפתרון, היא דרך טובה מאד ללמוד. האם להציג את הפתרון?