{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eIn order to collect geographical information on Mount Wolwz, a team of geographical observers needed to establish four observation points on the mountain. In order to obtain accurate data, the four observation points need to be exactly the \u003cspan class\u003d\"tex-font-style-bf\"\u003efour vertices of a square\u003c/span\u003e when viewed from the air. The observation algorithm used by the team required at least three of the observation points to be at the same height. And for the last observation point, which is at a different height to the other three, it needs to be at a \u003cspan class\u003d\"tex-font-style-bf\"\u003ehigher\u003c/span\u003e position than the other three.\u003c/p\u003e\u003cp\u003eThe top view of Mount Wolwz can be seen as a square with $$$n*n$$$ small square platforms, where each piece has an integer height. The group discussed that the higher the three observation points of the same height, the better the result. So they wanted to find out what the highest of the three observation points at the same height was.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input contains a total of $$$n + 1$$$ lines\u003c/p\u003e\u003cp\u003eThe first line contains an integer $$$n(2 \\leq n \\leq 300)$$$, representing the length of the side of Mount Wolwz\u003c/p\u003e\u003cp\u003eNext $$$n$$$ lines, th $$$i$$$-th line contains $$$n$$$ integers:$$$h_{i,1},h_{i,2},...,h_{i,j},...,h_{i,n}(1 \\leq h_{i,j} \\leq 10^{9})$$$, representing the height of each of the small platforms of Mount Wolwz\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eOne line contains an interger, representing the best height. If suitable observation points cannot be established in Mount Wolwz, output \"$$$-1$$$\"(without quotes).\u003c/p\u003e"}},{"title":"Examples","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\n1 1 3\n1 2 2\n3 2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","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\n1 2 1\n2 2 2\n1 2 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e-1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first example, $$$[(1,1),(1,2),(2,1),(2,2)]$$$ and $$$[(2,2),(3,2),(2,3),(3,3)]$$$ are all suitable observation point combinations.\u003c/p\u003e"}}]}