N islands form a tree. Touching island i changes lifespan by Xi days. Some islands are unsafe for landing or signaling. With only one flare, choose safe entry and exit islands to maximize lifespan gain. If the best gain is not positive, print Stay Home.
The first line contains T test cases (T≤10). Each test case gives N, N−1 bridges, array Xi, and a safe/island mask.
Print the maximum lifespan gain, or Stay Home if it is not positive.