{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eIn Land waterless, water is a very limited resource. People always fight for the biggest source of water. Given a sequence of water sources with $a_1, a_2, a_3, . . . , a_n$ representing the size of the water source. Given a set of queries each containing $2$ integers $l$ and $r$, please find out the biggest water source between $a_l$ and $a_r$.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"First you are given an integer $T (T \\leq 10)$ indicating the number of test cases. For each test case, there is a number $n (0 \\leq n \\leq 1000)$ on a line representing the number of water sources. $n$ integers follow, respectively $a_1, a_2, a_3, . . . , a_n$, and each integer is in $\\{1, . . . , 10^6\\}$. On the next line, there is a number $q (0 \\leq q \\leq 1000)$ representing the number of queries. After that, there will be $q$ lines with two integers $l$ and $r (1 \\leq l \\leq r \\leq n)$ indicating the range of which you should find out the biggest water source."}},{"title":"Output","value":{"format":"HTML","content":"For each query, output an integer representing the size of the biggest water source."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\n1\r\n100\r\n1\r\n1 1\r\n5\r\n1 2 3 4 5\r\n5\r\n1 2\r\n1 3\r\n2 4\r\n3 4\r\n3 5\r\n3\r\n1 999999 1\r\n4\r\n1 1\r\n1 2\r\n2 3\r\n3 3\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e100\r\n2\r\n3\r\n4\r\n4\r\n5\r\n1\r\n999999\r\n999999\r\n1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}