{"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eUsually, smartphones can be locked by either a password, fingerprint sensing, or facial recognition. There\u0027s also another commonly used method: \u003cspan class\u003d\"tex-font-style-it\"\u003ePattern Lock\u003c/span\u003e.\u003c/p\u003e\u003cp\u003e\u003cspan class\u003d\"tex-font-style-it\"\u003ePattern Lock\u003c/span\u003e allows you to lock and unlock your device by drawing a pattern onto the screen. The pattern is drawn by connecting a series of dots on a grid by a polygonal path. The grid of dots on the lock screen has $$$n$$$ rows and $$$m$$$ columns. The rows have equal spacing between each other, and so do the columns. We denote the dots in the $$$x$$$-th row and $$$y$$$-th column by $$$(x,y)$$$. And we use a sequence of dots to denote the pattern, i.e. the polygonal path. For example, the sequence $$$\\{(1,1),(2,3),(3,2),(2,2)\\}$$$ can denote the pattern shown in the picture below.\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/6423b3cfc43f37980d94bf3595648f3d?v\u003d1726246751\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e\u003cp\u003eLet\u0027s denote a pattern with $$$k$$$ dots as $$$\\{A_1,A_2,\\dots,A_k\\}$$$. A valid pattern to lock a smartphone should meet the following conditions:\u003c/p\u003e\u003cul\u003e \u003cli\u003e Each dot is visited no more than once. That is, for each $$$1 \\le i \u0026lt; j \\le k$$$, $$$A_i \\neq A_j$$$. \u003c/li\u003e\u003cli\u003e For each $$$1 \\le i \u0026lt; k$$$, the segment connecting $$$A_i$$$ and $$$A_{i+1}$$$ cannot pass through other dots. For example, $$$A_i\u003d(1,1),A_{i+1}\u003d(3,3)$$$ is invalid because the segment passes through $$$(2,2)$$$. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eLittle Rabbit wants his smartphone to be as secure as possible. Therefore, he needs a \u003cspan class\u003d\"tex-font-style-bf\"\u003estrong pattern\u003c/span\u003e to lock his device. A \u003cspan class\u003d\"tex-font-style-bf\"\u003estrong pattern\u003c/span\u003e is a valid pattern that meets some extra conditions:\u003c/p\u003e\u003cul\u003e \u003cli\u003e Each dot is visited exactly once. That is, $$$k\u003dn \\times m$$$. \u003c/li\u003e\u003cli\u003e For each $$$1 \u0026lt; i \u0026lt;k$$$, the angle formed by segment $$$A_iA_{i-1}$$$ and segment $$$A_iA_{i+1}$$$ must be an acute angle (less than $$$90^\\circ$$$). \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eCan you construct a \u003cspan class\u003d\"tex-font-style-bf\"\u003estrong pattern\u003c/span\u003e for him?\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input contains two integers $$$n$$$ and $$$m$$$ ($$$2 \\le n,m \\le 500$$$), representing the number of rows and columns of the grid.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eOutput $$$n \\times m$$$ lines. The $$$i$$$-th line contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \\le x_i \\le n$$$, $$$1 \\le y_i \\le m$$$), representing the $$$i$$$-th dot of the pattern is $$$(x_i,y_i)$$$.\u003c/p\u003e\u003cp\u003eIt can be proved that the answer always exists. If there are multiple answers, output any.\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\u003e2 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 1\n2 1\n1 2\n2 2\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\u003ePlease note that if the length or format of your output does not match the answer, you will possibly get a Presentation Error verdict.\u003c/p\u003e"}}]}