Prime Pairs in a Tree

Company: Uber

Difficulty: hard