Problem in short: There are N people, and person i takes a[i], b[i] and c[i] time to do task a, b, c respectively. Only one person can do task a at a given point of time, and each person must do tasks a, b, c in-order. In which order should the N people do task a, so as to minimize the time at which everyone is done with all of their tasks. N <= 2 * 10^5.

Indian National Olympiad in Informatics (INOI) is round 2 out of 3 (i.e. intermediate) for selection into Indian IOI team.