# queues medium

Leave From Either Door

Boarding was double-ended — so is leaving. The conductor calls which door serves next. 🚪🚪

You get commandsjoin:name (back), serve-front, or serve-back (serves always valid). Print the names in the order they LEFT, space-separated.

Example:

Input: commands = ["join:mia", "join:leo", "join:kai", "serve-back", "serve-front"] Output: kai mia

mia, leo, kai join the back in order (line: mia, leo, kai). serve-back removes kai from the back, then serve-front removes mia from the front.

💡 need a hint?

q-either-door.py🔒 given lines are locked — write your code in between
loading...