Can we create logic such that AGV picks whether there is an item in a queue (Q) or moves to the next pickup point or queue (Q)?

If there are Three queues such as Pickup Queue1, Pickup Queue 2, Pickup Queue3 and Dropoff Queue1, Dropoff Queue2, Dropoff Queue 3 etc

How can we write logic such that AGV picks whether an item is available in queue 1 and moves to the next queue if not? (and this logic should be repeated irrespective to number of queues maybe in loop)

I attempted this logic using process flows and sub flows but was unable to establish a loop.

Could anyone help me up? or suggestion? Thank you in Advance