{"trustable":false,"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":"MD","content":"Given a integer sequence $A$, and two integers $l$ and $r$, calculate:\n$$\n\\max\\{A_l,A_{l+1},...,A_{r}\\}\n$$"}},{"title":"Input","value":{"format":"MD","content":"On the first line, there is an integer $T \\ (T≤10)$, indicating the number of test cases.\n\nFor each test case:\n\n+ Firstly, there is a number $n(0≤n≤1000)$ on a line representing the length of the sequence. \n\n+ Then, $n$ integers follow, representing $A_1,A_2,A_3,...,A_n$, and each integer is in $[1,10^6]$.\n\n+ On the next line, there is a number $q (0≤q≤1000)$ representing the number of queries. \n\n+ After that, there will be $q$ lines ,each line contains two integers $l$ and $r$ $(1≤l≤r≤n)$ ."}},{"title":"Output","value":{"format":"MD","content":"For each query, output an integer representing the result."}},{"title":"Sample Input","value":{"format":"MD","content":"\u003cpre\u003e3\n1\n100\n1\n1 1\n5\n1 2 3 4 5\n5\n1 2\n1 3\n2 4\n3 4\n3 5\n3\n1 999999 1\n4\n1 1\n1 2\n2 3\n3 3\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"MD","content":"\u003cpre\u003e100\n2\n3\n4\n4\n5\n1\n999999\n999999\n1\u003c/pre\u003e"}}]}