{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"yass_top_edge_dummy\" style\u003d\"width: 1px; height: 1px; padding: 0px; margin: -9px 0px 0px; border-width: 0px; display: block;\"\u003e\r\n\t\u0026nbsp;\u003c/div\u003e\r\n\u003cdiv id\u003d\"yass_top_edge\" style\u003d\"background-image: url(\u0026quot;chrome://yass/content/edgebgtop.png\u0026quot;); background-attachment: scroll; background-position: center bottom; padding: 0px; margin: 0px 0px 8px -8px; border-width: 0px; height: 0px; display: block; width: 921px;\"\u003e\r\n\t\u0026nbsp;\u003c/div\u003e\r\n\u003cdiv class\u003d\"Section1\"\u003e\r\n\t\u003cspan style\u003d\"font-family:Arial;mso-bidi-font-weight:bold\"\u003e\u003co:p\u003e\u003c/o:p\u003e\u003c/span\u003e\r\n\t\u003cp class\u003d\"MsoBodyText3\"\u003e\r\n\t\t\u0026nbsp;Once upon a time, there lived a chimpanzee called \u003ci style\u003d\"mso-bidi-font-style:\r\nnormal\"\u003e\u003cspan data-scayt_word\u003d\"Shanto\" data-scaytid\u003d\"1\"\u003eZipu\u003c/span\u003e \u003cspan data-scayt_word\u003d\"Bandor\" data-scaytid\u003d\"3\"\u003eBandor\u003c/span\u003e (aka Playboy Chimp)\u003c/i\u003e. \u003cspan data-scayt_word\u003d\"Shanto\" data-scaytid\u003d\"2\"\u003eZipu\u003c/span\u003e was unhappily married to \u003ci style\u003d\"mso-bidi-font-style:normal\"\u003e\u003cspan data-scayt_word\u003d\"Bunty\" data-scaytid\u003d\"4\"\u003eBunty\u003c/span\u003e Mona\u003c/i\u003e, a short but cute little lady chimp. \u003cspan data-scayt_word\u003d\"Shanto\" data-scaytid\u003d\"5\"\u003eZipu\u003c/span\u003e was tall and handsome \u0026ndash; he was feeling uncomfortable taking \u003cspan data-scayt_word\u003d\"Bunty\" data-scaytid\u003d\"7\"\u003eBunty\u003c/span\u003e to public places along with him. People would stare at them all the while. At one point, \u003cspan data-scayt_word\u003d\"Shanto\" data-scaytid\u003d\"6\"\u003eZipu\u003c/span\u003e could not stand it anymore and he decided to do some justice to his name. He started looking for \u003ci style\u003d\"mso-bidi-font-style:normal\"\u003ea new hope \u003c/i\u003ein the Lady Chimps\u0026rsquo; High School. Every day \u003cspan data-scayt_word\u003d\"Shanto\" data-scaytid\u003d\"11\"\u003eZipu\u003c/span\u003e would climb up a bamboo tree and wait for the morning drill to start. From there he could see each and every lady chimp doing their routine drill. Now, \u003cspan data-scayt_word\u003d\"Shanto\" data-scaytid\u003d\"12\"\u003eZipu\u003c/span\u003e was looking for the tallest lady chimp that would be shorter than he; he would also like to consider someone a little taller than he. But someone of his same height will never be on his list. Every morning \u003cspan data-scayt_word\u003d\"Shanto\" data-scaytid\u003d\"13\"\u003eZipu\u003c/span\u003e picks up a line of lady chimps and finds the best two according to his set criterion. His job has been made easy by the fact that the lady chimps in each line are ordered by their height, the shortest one is in the front and the tallest one is at the back. Your task is to help \u003cspan data-scayt_word\u003d\"Shanto\" data-scaytid\u003d\"14\"\u003eZipu\u003c/span\u003e on one particular day to find two lady chimps: the tallest one shorter than he and the shortest one taller than he.\u003c/p\u003e\r\n\t\u003cp class\u003d\"MsoBodyText3\"\u003e\r\n\t\t\u003cspan style\u003d\"font-family:\u0026quot;Arial Unicode MS\u0026quot;\"\u003e\u0026nbsp;\u003co:p\u003e\u003c/o:p\u003e\u003c/span\u003e\u003c/p\u003e\r\n\t\u003cp class\u003d\"MsoNormal\"\u003e\r\n\t\t\u003cspan class\u003d\"StyleArial16pt\"\u003e\u003cspan style\u003d\"font-size:16.0pt;\r\nmso-bidi-font-size:10.0pt;font-family:Arial;mso-bidi-font-family:\u0026quot;Times New Roman\u0026quot;\"\u003eInput\u003c/span\u003e\u003c/span\u003e\u003cspan class\u003d\"StyleArial16pt\"\u003e\u003cspan style\u003d\"font-size:16.0pt;mso-bidi-font-size:10.0pt;\r\nfont-family:Arial;mso-fareast-font-family:\u0026quot;Arial Unicode MS\u0026quot;;mso-bidi-font-family:\r\n\u0026quot;Times New Roman\u0026quot;\"\u003e\u003co:p\u003e\u003c/o:p\u003e\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\r\n\t\u003cp class\u003d\"MsoBodyText3\"\u003e\r\n\t\tThere will be only one set of input for this problem. The first line of input gives you a number \u003cb\u003eN\u003c/b\u003e \u003cb\u003e(\u003cspan data-scayt_word\u003d\"1≤N≤50000\" data-scaytid\u003d\"26\"\u003e1\u0026le;N\u0026le;50000\u003c/span\u003e)\u003c/b\u003e, the number of lady chimps on the line. In the next line you would have \u003cb\u003eN\u003c/b\u003e integers (in the range \u003cb\u003e1\u003c/b\u003e to \u003cb\u003e2\u003csup\u003e31\u003c/sup\u003e-1\u003c/b\u003e) giving the heights of the \u003cb\u003eN\u003c/b\u003e chimps. There would be a single space after every number. You can assume that the chimps are ordered in non-decreasing order of their heights. In the next line you would have an integer \u003cb\u003eQ (\u003cspan data-scayt_word\u003d\"1≤Q≤25000\" data-scaytid\u003d\"29\"\u003e1\u0026le;Q\u0026le;25000\u003c/span\u003e)\u003c/b\u003e giving the number of queries. Then in the next line \u003cb\u003eQ\u003c/b\u003e queries will follow. Then you would have \u003cb\u003eQ\u003c/b\u003e numbers giving the height of \u003cspan data-scayt_word\u003d\"Shanto\" data-scaytid\u003d\"27\"\u003eZipu\u003c/span\u003e! Don\u0026rsquo;t worry, \u003cspan data-scayt_word\u003d\"Shanto\" data-scaytid\u003d\"28\"\u003eZipu\u003c/span\u003e is from the land where people can have \u003cb\u003e3\u003c/b\u003e \u003cspan data-scayt_word\u003d\"birthdates\" data-scaytid\u003d\"32\"\u003ebirthdates\u003c/span\u003e; \u003cb\u003eQ\u003c/b\u003e heights for a chimpanzee will make no difference here. The \u003cb\u003eQ\u003c/b\u003e numbers are listed on a line and their range from \u003cb\u003e1 to 2\u003csup\u003e31\u003c/sup\u003e-1\u003c/b\u003e, and as before you would find a single space after every query number. The query numbers are not supposed to come in any particular order.\u003c/p\u003e\r\n\t\u003cp class\u003d\"MsoBodyText3\"\u003e\r\n\t\t\u0026nbsp;\u003c/p\u003e\r\n\t\u003ch3\u003e\r\n\t\t\u003cspan class\u003d\"StyleArial16pt\"\u003e\u003cspan style\u003d\"font-size:16.0pt;mso-bidi-font-size:\r\n10.0pt;font-family:Arial;mso-bidi-font-family:\u0026quot;Times New Roman\u0026quot;\"\u003eOutput\u003co:p\u003e\u003c/o:p\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h3\u003e\r\n\t\u003cp\u003e\r\n\t\t\u003cspan style\u003d\"font-style:normal\"\u003eFor each query height, print two numbers in one line. The first one would be the height of the tallest lady chimp that is shorter than \u003cspan data-scayt_word\u003d\"Shanto\" data-scaytid\u003d\"33\"\u003eZipu\u003c/span\u003e, and the next number would be the height of the shortest lady chimp that is taller than he. These two numbers are to be separated by a single space. Whenever it is impossible to find any of these two heights, replace that height with an uppercase \u003cb\u003e\u0026lsquo;X\u0026rsquo;\u003c/b\u003e\u003c/span\u003e.\u003cspan style\u003d\"font-style:\r\nnormal\"\u003e\u003co:p\u003e\u003c/o:p\u003e\u003c/span\u003e\u003c/p\u003e\r\n\t\u003cbr /\u003e\r\n\t\u003cb\u003e\u003cspan style\u003d\"font-size:18.0pt;mso-bidi-font-size:10.0pt\"\u003e\u003co:p\u003e\u003c/o:p\u003e\u003c/span\u003e\u003c/b\u003e\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cp\u003e\r\n\t\u003cspan style\u003d\"font-size:18px;\"\u003e\u003cstrong\u003e4\u003c/strong\u003e\u003c/span\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u003cspan style\u003d\"font-size:18px;\"\u003e\u003cstrong\u003e1 4 5 7\u003c/strong\u003e\u003c/span\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u003cspan style\u003d\"font-size:18px;\"\u003e\u003cstrong\u003e4\u003c/strong\u003e\u003c/span\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u003cspan style\u003d\"font-size:18px;\"\u003e\u003cstrong\u003e4 6 8 10\u003c/strong\u003e\u003c/span\u003e\u003c/p\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cp\u003e\r\n\t\u003cspan style\u003d\"font-size:16px;\"\u003e\u003cstrong\u003e1 5\u003c/strong\u003e\u003c/span\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u003cspan style\u003d\"font-size:16px;\"\u003e\u003cstrong\u003e5 7\u003c/strong\u003e\u003c/span\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u003cspan style\u003d\"font-size:16px;\"\u003e\u003cstrong\u003e7 X\u003c/strong\u003e\u003c/span\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u003cspan style\u003d\"font-size:16px;\"\u003e\u003cstrong\u003e7 X\u003c/strong\u003e\u003c/span\u003e\u003c/p\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003ch5\u003e\r\n\t\u003cspan style\u003d\"font-size:14px;\"\u003e\u003cb\u003e/*Note: You should at least use \u003cspan data-scayt_word\u003d\"scanf\" data-scaytid\u003d\"15\"\u003escanf\u003c/span\u003e() and \u003cspan data-scayt_word\u003d\"printf\" data-scaytid\u003d\"16\"\u003eprintf\u003c/span\u003e() to take input and produce output for this problem. \u003cspan data-scayt_word\u003d\"cin\" data-scaytid\u003d\"17\"\u003ecin\u003c/span\u003e and \u003cspan data-scayt_word\u003d\"cout\" data-scaytid\u003d\"18\"\u003ecout\u003c/span\u003e is too slow for this problem to get it within time limit. Sorry for this but otherwise it becomes impossible for us to set a reasonable time limit.*/\u003c/b\u003e\u003c/span\u003e\u003c/h5\u003e"}}]}