Problem Description
Given an array of integers of length .
It is allowed to perform the following operation any number of times (including zero):
choose an element of the array that is at least , remove it, and replace it with the digits it consists of, preserving the order of the digits and the position in the array.
For example, the number can be replaced with , and the number can be replaced with .
You need to determine whether it is possible to obtain an array sorted in non-decreasing order, that is, where is the current length of the array.
Input
In the first line, an integer () is given — the number of input data sets.
For each set:
- in the first line, an integer () is given;
- in the second line, an array ().
The sum of across all tests does not exceed .
Output
For each data set, output YES if it is possible to obtain a non-decreasing array, and NO otherwise.
The case of letters in the answer does not matter.
Scoring System
| Group | Additional Constraints | Points | Required Groups |
|---|---|---|---|
| 0 | examples | 0 | — |
| 1 | 10 | — | |
| 2 |
Examples
3 4 12 3 45 67 3 12 28 5 2 0 0
Yes No Yes