{"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":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e\r\n\t\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003eTom and Jerry are playing a game \u003cspan data-scayt_word\u003d\"Northcott\" data-scaytid\u003d\"2\"\u003eNorthcott\u003c/span\u003e, but Tom always lose, so he suspected that the game is not there some sort of winning strategy, Tom depressed help to you now, you can help him?\u003c/span\u003e\u003cbr /\u003e\r\n\t\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003eRules of the game is like this:\u003c/span\u003e\u003cbr /\u003e\r\n\t\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003eAs shown, the game in a row m column n (1 \u0026le; n \u0026le; 1000 and 2 \u0026le; m \u0026le; 100) on the board, each row has a sunspot (Black) and an albino (white square).\u003c/span\u003e\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003eUsing these pieces of the party first, each player can move one\u0026#39;s any one piece to the same line of any one space, of course, this process must not cross the line of the enemy \u003c/span\u003e\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003epawn. \u003c/span\u003e\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003eBoth sides take turns moving until a party can not move up, move the final step of the players \u003c/span\u003e\u003cspan data-scayt_word\u003d\"wins.Tom\" data-scaytid\u003d\"1\"\u003e\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003ewins.\u003c/span\u003e\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003eTom\u003c/span\u003e\u003c/span\u003e\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003e is always under the first (black square).\u003c/span\u003e\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003eFigure 1 is an initial situation, Figure 2 is after Tom moved a piece of the situation (the first line of sunspots left two steps).\u003c/span\u003e\u003cbr /\u003e\r\n\t\u003cbr /\u003e\r\n\t\u003ccenter\u003e\r\n\t\t\u003cimg src\u003d\"http://acm.hdu.edu.cn/data/images/C63-1003-1.png\" /\u003e\u003cbr /\u003e\r\n\t\t\u003cbr /\u003e\r\n\t\t\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003eFigure 1\u003c/span\u003e\u003c/center\u003e\r\n\t\u003cbr /\u003e\r\n\t\u003cbr /\u003e\r\n\t\u003ccenter\u003e\r\n\t\t\u003cimg src\u003d\"http://acm.hdu.edu.cn/data/images/C63-1003-2.png\" /\u003e\u003cbr /\u003e\r\n\t\t\u003cbr /\u003e\r\n\t\t\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\"\u003eFigure 2\u003c/span\u003e\u003c/center\u003e\r\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e\r\n\t  \u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003eMultiple sets of input data.\u003c/span\u003e\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003e The first two acts of each data integers n and m, separated by spaces.\u003c/span\u003e \u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003eThen there are n rows, each two numbers Ti, \u003cspan data-scayt_word\u003d\"Ji\" data-scaytid\u003d\"3\"\u003eJi\u003c/span\u003e (1 \u0026le; Ti, \u003cspan data-scayt_word\u003d\"Ji\" data-scaytid\u003d\"4\"\u003eJi\u003c/span\u003e \u0026le; m), respectively, Tom and Jerry in the line of pieces in which the number of columns.\u003c/span\u003e\u003cbr /\u003e\r\n\t\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\"\u003e\u003cb\u003eNote: Each group of test data between a variable number of blank lines.\u003c/b\u003e\u003c/span\u003e\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\"\u003e \u003cb\u003eYou have to deal with the end of the file.\u003c/b\u003e\u003c/span\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e\r\n\t\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003eFor each test data output line of your results.\u003c/span\u003e\u0026nbsp;\u003cspan onmouseout\u003d\"_tipoff()\" onmouseover\u003d\"_tipon(this)\" style\u003d\"\"\u003e If the current situation with Tom winning strategy under the output \u0026quot;I WIN!\u0026quot;, Otherwise output \u0026quot;BAD LUCK!\u0026quot;.\u003c/span\u003e\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e\r\n\t\u003cpre\u003e\r\n\t\u003c/pre\u003e\r\n\t\u003cdiv style\u003d\"font-family: Courier New,Courier,monospace;\"\u003e\r\n\t\t\u003cpre\u003e\r\n\t\t3 6\r\n4 5\r\n1 2\r\n1 2\r\n\r\n3 6\r\n4 5\r\n1 3\r\n1 2\u003c/pre\u003e\r\n\t\u003c/div\u003e\r\n\u003c/div\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e\r\n\t\u003cpre\u003e\r\n\t\u003c/pre\u003e\r\n\t\u003cdiv style\u003d\"font-family: Courier New,Courier,monospace;\"\u003e\r\n\t\t\u003cpre\u003e\r\n\t\tBAD LUCK!\r\nI WIN!\u003c/pre\u003e\r\n\t\u003c/div\u003e\r\n\u003c/div\u003e"}}]}