{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e \n \u003cp align\u003d\"justify\"\u003e For sure, the Lamborghinis will roll again on this summer\u0027s street parade. Each year, the organisers decide on a fixed order for the decorated trucks. Experience taught them to keep free a side street to be able to bring the trucks into order. \u003cbr\u003e\u003cbr\u003e The side street is so narrow that no two cars can pass each other. Thus, the Lamborghini that enters the side street last must necessarily leave the side street first. Because the trucks and the ravers move up closely, a truck cannot drive back and re-enter the side street or the approach street. \u003cbr\u003e\u003cbr\u003e You are given the order in which the Lamborghinis arrive. Write a program that decides if the Lamborghinis can be brought into the order that the organisers want them to be. \u003c/p\u003e \n \u003ch3\u003eInput\u003c/h3\u003e \n \u003cp align\u003d\"justify\"\u003e There are several test cases. The first line of each test case contains a single number n, the number of Lamborghinis. The second line contains the numbers 1 to n in an arbitrary order. All the numbers are separated by single spaces. These numbers indicate the order in which the trucks arrive in the approach street. No more than 1000 Lamborghinis participate in the street parade. Input ends with number 0. \u003c/p\u003e \n \u003ch3\u003eOutput\u003c/h3\u003e \n \u003cp align\u003d\"justify\"\u003e For each test case your program has to output a line containing a single word \"\u003ctt\u003eyes\u003c/tt\u003e\" if the Lamborghinis can be re-ordered with the help of the side street, and a single word \"\u003ctt\u003eno\u003c/tt\u003e\" in the opposite case. \u003c/p\u003e \n \u003ch3\u003eExample\u003c/h3\u003e \n \u003cpre\u003e\n\u003cb\u003eSample input:\u003c/b\u003e\n5\n5 1 2 4 3 \n0\n\n\u003cb\u003eSample output:\u003c/b\u003e\nyes\u003c/pre\u003e \n \u003ch3\u003eIllustration\u003c/h3\u003e \n \u003cp\u003e The sample input reflects the following situation:\u003cbr\u003e \u003cimg src\u003d\"CDN_BASE_URL/e9d2b04a8eea145c4c7b7b9d41a892d7?v\u003d1651451811\"\u003e \u003c/p\u003e\n \u003cp\u003e The five trucks can be re-ordered in the following way:\u003cbr\u003e \u003cimg src\u003d\"CDN_BASE_URL/3850c71eea4525e748c0f698bbf443c9?v\u003d1651451811\"\u003e \u003cimg src\u003d\"CDN_BASE_URL/e86520ee34cb455854fbddcb4a14de0b?v\u003d1651451811\"\u003e \u003cimg src\u003d\"CDN_BASE_URL/8a292d5d29444d37079f9ec1e2c04685?v\u003d1651451811\"\u003e \u003cimg src\u003d\"CDN_BASE_URL/79d780de876deb764d825b130405cea6?v\u003d1651451811\"\u003e \u003cimg src\u003d\"CDN_BASE_URL/a94cce1fd4af9d5cfccda03c0c558bea?v\u003d1651451811\"\u003e \u003c/p\u003e\n\u003c/div\u003e"}}]}