A stack that knows its minimum

A normal stack can tell you its top instantly, but not its smallest item. Keep a second stack alongside, holding the minimum so far: whenever you push a value, also push the smaller of that value and the current minimum; whenever you pop, pop both. The top of the second stack is always the minimum of what is left.

Write min_after(operations) that applies a list of operations to an empty stack and returns a list with the current minimum after each operation, or None when the stack is empty. Operations are ("push", value) and ("pop",). A pop on an empty stack is ignored.

min_after([("push", 5), ("push", 3), ("push", 7), ("pop",), ("pop",)])  ->  [5, 3, 3, 3, 5]
def min_after(operations):
    ...