#K52912. Reading Consistency Checker

    ID: 29415 Type: Default 1000ms 256MiB

Reading Consistency Checker

Reading Consistency Checker

You are given data for multiple books and must determine if each book's reading log is consistent. For each book, the reading log is represented by a sequence of page counts recorded over consecutive days. The log is considered consistent if the page counts never decrease, i.e., if for a sequence \(a_1, a_2, \dots, a_N\) it holds that \(a_1 \le a_2 \le \cdots \le a_N\). Otherwise, the log is inconsistent.

inputFormat

The input is read from standard input (stdin). The first line contains a single integer \(T\) representing the number of books. For each book, there are two lines:

  • The first line contains a string \(\text{ISBN}\) (without spaces) and an integer \(N\) representing the number of days.
  • The second line contains \(N\) space-separated integers denoting the page counts for each day in the order they were recorded.

outputFormat

For each book, output a single line to standard output (stdout) containing the ISBN and the word "YES" if the sequence of page counts is non-decreasing, or "NO" otherwise. The ISBN and the result are separated by a space.

## sample
2
123456789X 5
10 20 30 40 50
9876543210 6
15 20 15 25 30 35
123456789X YES

9876543210 NO

</p>