Bag queue and stack