P3018 [USACO11MAR] Tree Decoration G

Description

Farmer John is decorating his Spring Equinox Tree (like a Christmas tree but popular about three months later). It can be modeled as a rooted mathematical tree with N (1

Input Format

\* Line 1: A single integer: N \* Lines 2..N+1: Line i+1 contains three space-separated integers: P\_i, C\_i, and T\_i

Output Format

\* Line 1: A single integer: The minimum time to place all the ornaments