Given an organisation N-ary tree (id, name, child orgs, rank, parent), output nodes depth-first while respecting rank priority among siblings.
Asked in the Technical stage. Implement output_org_ids(root). Each node is a dictionary with id, name, child_orgs, rank, and parent; parent is informational and may be null. Return node IDs in preorder depth-first traversal. Sort each node's children by ascending rank; equal ranks retain their original child-list order.
def output_org_ids(root):