KTX

No attempts yetTime limit1sMemory limit128 MB

Problem

Korail is starting a pilot service that gives every KTX train on the Seoul to Busan line a grade. The grades are 11 through MM, and a train with a smaller number has to reach the destination station earlier.

The track has one main line and two bypass tracks, as in the picture.

Trains reach the junction in the order they left the departure station. At the junction each train takes one of these two options.

  • It stays on the main line. Trains on the main line cannot stop or overtake, so they enter the destination station in the order they passed the junction.
  • It pulls into one of the two bypass tracks and waits. A train on a bypass track can run as slowly as it likes, so it can come out as late as you want, but it rejoins the main line only after every train that entered the same bypass track later has left. A bypass track holds any number of trains.

For example, if the departure order is 1,3,2,41, 3, 2, 4, send grade 1 down the main line, park grade 3 on a bypass track, let grade 2 pass, then release grade 3, and finally send grade 4 through. The trains enter the destination station in the order 1,2,3,41, 2, 3, 4.

Given the departure order, write a program that decides whether the trains can enter the destination station in grade order, from 1 to MM.

Input

Input comes from standard input. The first line has the number of test cases TT (1T201 \le T \le 20). Each test case is two lines. The first line has the number of trains MM (1M1001 \le M \le 100), and the second line has the grades N1,N2,,NMN_1, N_2, \ldots, N_M in departure order, separated by single spaces. Every NiN_i is between 11 and MM and they are all different, so each number from 11 to MM appears exactly once.

Output

Output goes to standard output. Print one line per test case: YES if the trains can arrive in grade order, NO otherwise.