Loop while any of the pre-merge queues are empty