#K94897. Employee Work Hours Anomaly Detection

    ID: 38743 Type: Default 1000ms 256MiB

Employee Work Hours Anomaly Detection

Employee Work Hours Anomaly Detection

A company tracks its employees' working hours, and each employee's workday is divided into several time intervals. However, anomalies may occur in the recorded intervals. An anomaly is defined as one of the following:

  • An interval with a start time or end time outside the range \(0 \leq t \leq 24\), or where the start time is not strictly less than the end time.
  • Overlapping intervals within the same day for a single employee.

Your task is to analyze the intervals for each employee and determine whether there is at least one anomaly. If any anomaly exists, output "YES"; otherwise, output "NO".

inputFormat

The input is given via stdin in the following format:

  n
  m₁ start₁ end₁ start₂ end₂ ... startₘ₁ endₘ₁
  m₂ start₁ end₁ start₂ end₂ ... startₘ₂ endₘ₂
  ...
  mₙ start₁ end₁ ... startₘₙ endₘₙ

Here, \(n\) is the number of employees. For each employee, the first integer \(m\) denotes the number of working time intervals, followed by \(2m\) integers representing the start and end times of each interval.

outputFormat

Output a single line to stdout: "YES" if there is at least one anomaly detected in any employee's record, otherwise output "NO".

## sample
3
2 9 12 13 18
3 10 14 12 16 15 19
1 20 26
YES