Try to pop from queues beginning with the highest-priority one, not the lowest-priority one.