402183: GYM100687 I ACM Student Chapter (A)
Description
The ACM Student Chapter created a new Facebook group to answer the questions of the students currently taking the Structured Programming course.
Dr. Ibrahim asked the group administrators to answer any question within at most 3 hours. So, if a question is posted at time 08:04:02, one of the admins must post a reply strictly before 11:04:02.
Although Dr. Ibrahim is not a member in the group, he has a spy that sends him everyday a summary of when the questions were asked and when they were answered.
Write a program that allows Dr. Ibrahim to know automatically if all questions were answered within 3 hours or not.
InputThe first line of input contains an integer N (1 ≤ N ≤ 50) representing the number of questions.
Each of the following N lines contains the time at which one of the questions was posted, followed by a space, then the time at which the reply was posted.
The format of the time is: HH:MM:SS (00 ≤ HH ≤ 23), (00 ≤ MM, SS ≤ 59).
It’s guaranteed that the given data is valid (no reply precedes its post) and within one day.
OutputPrint “Yes” if all the questions were answered within 3 hours, otherwise print “No”.
ExamplesInput3Output
00:00:00 01:30:25
00:58:33 02:24:45
18:16:42 21:16:41
YesInput
3Output
00:00:00 01:30:25
00:58:33 02:24:45
18:16:42 21:16:42
No