beverages: topological sort