Write task_order(tasks) where tasks maps each task to the list of tasks it depends on.
Return an order in which every task appears after everything it depends on. When several orders are valid, return the one that is alphabetically smallest at each step, so the answer is predictable.
A circular dependency has no valid order - return None.