402183: GYM100687 I ACM Student Chapter (A)

Memory Limit:64 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. ACM Student Chapter (A)time limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard output

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.

Input

The 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.

Output

Print “Yes” if all the questions were answered within 3 hours, otherwise print “No”.

ExamplesInput
3
00:00:00 01:30:25
00:58:33 02:24:45
18:16:42 21:16:41
Output
Yes
Input
3
00:00:00 01:30:25
00:58:33 02:24:45
18:16:42 21:16:42
Output
No

加入题单

上一题 下一题 算法标签: