Priest John's Busiest Day
题号:NC51346
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
Special Judge, 64bit IO Format: %lld

题目描述

John is the only priest in his town. September 1st is the John's busiest day in a year because there is an old legend in the town that the couple who get married on that day will be forever blessed by the God of Love. This year N couples plan to get married on the blessed day. The i-th couple plan to hold their wedding from time S_i to time T_i. According to the traditions in the town, there must be a special ceremony on which the couple stand before the priest and accept blessings. The i-th couple need Di minutes to finish this ceremony. Moreover, this ceremony must be either at the beginning or the ending of the wedding (i.e. it must be either from S_i to S_i + D_i, or from T_i - D_i to T_i). Could you tell John how to arrange his schedule so that he can present at every special ceremonies of the weddings.
Note that John can not be present at two weddings simultaneously.

输入描述:

The first line contains a integer . 
The next N lines contain the S_i, T_i and D_i. S_i and T_i are in the format of hh:mm.

输出描述:

The first line of output contains "YES" or "NO" indicating whether John can be present at every special ceremony. If it is "YES", output another N lines describing the staring time and finishing time of all the ceremonies.
示例1

输入

复制
2
08:00 09:00 30
08:15 09:00 20

输出

复制
YES
08:00 08:30
08:40 09:00