{"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\"\u003ePaul draw a big m*n matrix A last month, whose entries Ai,j are all integer numbers ( 1 \u0026lt;\u003d i \u0026lt;\u003d m, 1 \u0026lt;\u003d j \u0026lt;\u003d n ). Now he selects some sub-matrices, hoping to find the maximum number. Then he finds that there may be more than one maximum number, he also wants to know the number of them. But soon he find that it is too complex, so he changes his mind, he just want to know whether there is a maximum at the four corners of the sub-matrix, he calls this “Check corners”. It’s a boring job when selecting too many sub-matrices, so he asks you for help. (For the “Check corners” part: If the sub-matrix has only one row or column just check the two endpoints. If the sub-matrix has only one entry just output “yes”.)\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There are multiple test cases. \u003cbr\u003e\u003cbr\u003eFor each test case, the first line contains two integers m, n (1 \u0026lt;\u003d m, n \u0026lt;\u003d 300), which is the size of the row and column of the matrix, respectively. The next m lines with n integers each gives the elements of the matrix which fit in non-negative 32-bit integer. \u003cbr\u003e\u003cbr\u003eThe next line contains a single integer Q (1 \u0026lt;\u003d Q \u0026lt;\u003d 1,000,000), the number of queries. The next Q lines give one query on each line, with four integers r1, c1, r2, c2 (1 \u0026lt;\u003d r1 \u0026lt;\u003d r2 \u0026lt;\u003d m, 1 \u0026lt;\u003d c1 \u0026lt;\u003d c2 \u0026lt;\u003d n), which are the indices of the upper-left corner and lower-right corner of the sub-matrix in question. \u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, print Q lines with two numbers on each line, the required maximum integer and the result of the “Check corners” using “yes” or “no”. Separate the two parts with a single space."}},{"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\u003e4 4\r\n4 4 10 7\r\n2 13 9 11\r\n5 7 8 20\r\n13 20 8 2\r\n4\r\n1 1 4 4\r\n1 1 3 3\r\n1 3 3 4\r\n1 1 1 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e20 no\r\n13 no\r\n20 yes\r\n4 yes\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}