You are given an n-ary tree where each node represents a machine in a distributed cluster. Each node knows its own ID, its parent node (null if root), and its list of children. Nodes can only communicate with their direct parent or children via two provided APIs: sendAsyncMessage(nodeId, message_string) (treat…