P9222 "PEOI Rd1" Morning or Afternoon

Description

There is a pointer alarm clock that can show the date using a rotating dial. I observed it from one moment to another moment (a closed interval). Now I want to know whether I can be sure to infer whether it is currently in the morning or in the afternoon by checking whether the date changes during this interval. The alarm clock updates the date exactly at $12:00$ in the morning. After $11:59$ in the morning/afternoon, the time becomes $12:00$ in the afternoon/morning. After $12:59$ in the morning/afternoon, the time becomes $1:00$ in the morning/afternoon.

Input Format

The first line contains a positive integer $T$, the number of test cases. The next $T$ lines each contain two times separated by a space, representing the start observation time and the end observation time. Note that the observation time interval is a closed interval. A time is given in the form $\texttt{(a)b:cd}$, where $\texttt{ab}$ is the hour and $\texttt{cd}$ is the minute. If the $\tt a$ digit is not omitted, then ${\tt a}\not=0$. It is guaranteed that $\\texttt{ab}\in[1,12]$ and $\texttt{cd}\in[0,59]$.

Output Format

For each test case, output one line: if you can determine it for sure, output `Yes`; otherwise output `No`.

Explanation/Hint

### Sample Explanation #1 Because I observed from $11:30$ to $12:20$ (assume this $12:20$ is the first time it is observed; the a.m./p.m. of later occurrences of $12:20$ can be inferred from the current situation, because I know which occurrence the right endpoint $12:20$ is), I can determine whether the time is in the morning or afternoon by checking whether the date was updated during this period. For example, if I see that the clock updated the date during this period, then $12:20$ must be in the morning; otherwise $12:20$ must be in the afternoon. Sample #3 is similar. ### Sample Explanation #2 It could be from $12:20$ a.m. to $5:00$ a.m., or it could be from $12:20$ p.m. to $5:00$ p.m. In both cases, the date cannot change, so I cannot determine it. ### Constraints For $18\%$ of the points, all times are guaranteed not to have hour $=12$ (that is, times like `12:25` will not appear). For another $9\%$ of the points, $T=1$. $\color{#fff}\sout\text{No, Commander-in-Chief!}$ For $100\%$ of the testdata, $T\leqslant 100$, $\overline\texttt{ab}\in[1,12]$, and $\overline\texttt{cd}\in[0,59]$. Translated by ChatGPT 5