{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003ch1\u003eYama\u003c/h1\u003e\n\n\u003ccenter\u003e\n\u003cimg src\u003d\"CDN_BASE_URL/c6d8117e2949747585c1dc2953fadf7a?v\u003d1713688254\"\u003e\n\u003c/center\u003e\n\u003cbr\u003e\n\n\u003cp\u003e\nThere is a container that is divided into two branches as shown in the figure. There are 10 balls numbered from 1 to 10, which are dropped from the opening A of the container. The balls are then placed into either the left tube B or the right tube C. The board D can rotate left and right around the pivot point E, so by moving the board D, you can decide whether to put the balls into tube B or tube C.\n\u003c/p\u003e\n\n\u003cp\u003e\nYou are given the order in which the balls are dropped from the opening A. Place them in order into tube B or tube C. At this time, if both tube B and tube C can arrange the larger balls on top of the smaller numbered balls, output YES; otherwise, output NO. It is assumed that the order of the balls cannot be changed inside the container. Also, it is allowed to continue placing balls into the same tube, and both tube B and tube C have enough space for all 10 balls.\n\u003c/p\u003e\n\n\n\u003ch2\u003eInput\u003c/h2\u003e\n\n\u003cp\u003e\nMultiple datasets are given. The number of datasets \u003cvar\u003eN\u003c/var\u003e is given on the first line. This is followed by \u003cvar\u003eN\u003c/var\u003e lines of datasets. Each dataset consists of 10 numbers given in order from left to right separated by spaces.\n\u003c/p\u003e\n\n\u003ch2\u003eOutput\u003c/h2\u003e\n\n\u003cp\u003e\nFor each dataset, output \u003cspan\u003eYES\u003c/span\u003e or \u003cspan\u003eNO\u003c/span\u003e on a single line.\n\u003c/p\u003e\n\n\u003ch2\u003eSample Input\u003c/h2\u003e\n\n\u003cpre\u003e2\n3 1 4 2 5 6 7 8 9 10\n10 9 8 7 6 5 4 3 2 1\n\u003c/pre\u003e\n\n\u003ch2\u003eOutput for the Sample Input\u003c/h2\u003e\n\n\u003cpre\u003eYES\nNO\n\u003c/pre\u003e"}}]}