{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"2011 was a crazy year. Many people all over the world proposed on 11-11-11, married on 11-11-11, some even went through surgery only to have 11-11-11 as their child\u0027s birth date. How crazy people can be! Don\u0027t they see there is a \"20\" hidden? Then what to do? A very elegant solution came from ARR, a very famous and funny character - why do we need to follow Christian (or some calls it Gregorian) calendar? Why don\u0027t we start our own calendar on the day of marriage? And those who like to celebrate their marriage ceremony too frequent, why don\u0027t they declare only 1 day per year. In that fashion they can celebrate their anniversary every day. And may be one minute a year or a second or ... Uh.. getting complex.\n\nLet\u0027s back to the title. From now, we start to have a new calendar system, \u0026quot;Kisu Pari Na\u0026quot;. And wehope to update this calendar on every national contest.The purpose of this calendar is - we all will try our best to learn something new in every year. For this first year let\u0027s learn some combinatory. It reminds me of my first year in college. I faced this problem but could not solve this then. But see how easy it is:\n\n\n\n| \u0026nbsp; | \u0026nbsp; | \u0026nbsp; | \u0026nbsp; |\n| ------ | ------ | ------ | ------ |\n| \u0026nbsp; | \u0026nbsp; | \u0026nbsp; | \u0026nbsp; |\n| \u0026nbsp; | \u0026nbsp; | \u0026nbsp; | \u0026nbsp; |\n\n\n\nSay you start from upper left cell and want to go to lower right cell. The only restriction is you can only move downward or rightward. How many ways are there? How to solve it? Not that difficult. You have to go two times Down and three times Right (whichever way you try) to reach the goal from the starting cell, right? So the answer is number of ways you can arrange two **D** (represents Down) and three **R** (represent Right). 2 same characters and 3 same characters, total 5 characters. So it is: \n\n$$\\frac{5!}{2! 3!} \\space or \\space \\frac{(D + R)!}{D! R!} \u003d \\binom{D + R}{R}$$\n\nEasy isn\u0027t it? Ok enough with the learning. Now back to problem, given a grid and at each cell there are some coins. Inky and Pinky are playing a game getting inspiration from the above problem. At each turn, a player chooses a non empty cell and then removes one or more coins from that cell and put them to the cell exactly right of it or exactly beneath it. A player can\u0027t divide the coins and put one part to right and others to down. Note that, for the cells at the right column the player can\u0027t move it to more right, and same for the bottom-most row. So a player can\u0027t move coins from the lower right cell. The game will finish when no moves are available and the player who moved last will win. Now inky being very modest asked Pinky to move first. Can you say if Pinky will win if both play perfectly?"}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026#8804; 100)**,denoting the number of test cases.\n\t\nEach case starts with a line containing two integers **R C(1 \u0026#8804; R * C \u0026#8804; 50000)**, where **R** denotes the number of rows and **C** denotes the number of columns of the grid respectively. Each ofthe next **R** lines contains **C** space separated integers denoting the grid. These integers lie in the range **[0, 10\u003csup\u003e9\u003c/sup\u003e]**."}},{"title":"Output","value":{"format":"MD","content":"For every test case, output case number followed by `win` if Pinky can win or `lose`."}},{"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\u003e1\n2 2\n1 1\n1 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: lose\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"MD","content":"Dataset is huge, use faster I/O methods."}}]}