{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003ctable border\u003d\"3\" cellpadding\u003d\"3\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd\u003e\u003cimg src\u003d\"CDN_BASE_URL/9ed32814e28096a7b2ab1490dcae5165?v\u003d1714763019\"\u003e\u003c/td\u003e\u003ctd\u003e\u003cimg src\u003d\"CDN_BASE_URL/cbbe6759ea7d5aeafd8a087177461776?v\u003d1714763019\"\u003e\u003cbr\u003e\u003c/td\u003e\u003ctd\u003e\u003cimg src\u003d\"CDN_BASE_URL/9f2c0ae4bbea25d7c889752b0c7bc5c4?v\u003d1714763019\"\u003e\u003cbr\u003e\u003c/td\u003e\u003ctd\u003e\u003cimg src\u003d\"CDN_BASE_URL/54d7b8f80fa928d77c6c6eb210c46d85?v\u003d1714763019\"\u003e\u003cbr\u003e\u003c/td\u003e\u003ctd\u003e\u003cimg src\u003d\"CDN_BASE_URL/a780a1c88d62a76d263195b84ffb8788?v\u003d1714763019\"\u003e\u003cbr\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003eFigure 1\u003c/td\u003e\u003ctd\u003eFigure 2\u003c/td\u003e\u003ctd\u003eFigure 3a\u003c/td\u003e\u003ctd\u003eFigure 3b\u003c/td\u003e\u003ctd\u003eFigure 4\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\r\u003cbr\u003eYour task is to decide if a specified sequence of moves in the board game Twixt ends with a winning move.\r\u003cbr\u003e\r\u003cbr\u003eIn this version of the game, different board sizes may be specified. Pegs are placed on a board at integer coordinates in the range [0, N]. Players Black and White use pegs of their own color. Black always starts and then alternates with White, placing a peg at one unoccupied position (x,y). Black\u0027s endzones are where x equals 0 or N, and White\u0027s endzones are where y equals 0 or N. Neither player may place a peg in the other player\u0027s endzones. After each play the latest position is connected by a segment to every position with a peg of the same color that is a chess knight\u0027s move away (2 away in one coordinate and 1 away in the other), provided that a new segment will touch no segment already added, except at an endpoint. Play stops after a winning move, which is when a player\u0027s segments complete a connected path between the player\u0027s endzones.\r\u003cbr\u003e\r\u003cbr\u003eFor example Figure 1 shows a board with N\u003d4 after the moves (0,2), (2,4), and (4,2). Figure 2 adds the next move (3,2). Figure 3a shows a poor next move of Black to (2,3). Figure 3b shows an alternate move for Black to (2,1) which would win the game.\r\u003cbr\u003e\r\u003cbr\u003eFigure 4 shows the board with N\u003d7 after Black wins in 11 moves:\r\u003cbr\u003e(0, 3), (6, 5), (3, 2), (5, 7), (7, 2), (4, 4), (5, 3), (5, 2), (4, 5), (4, 0), (2, 4).\r\u003cbr\u003e\r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input contains from 1 to 20 datasets followed by a line containing only two zeroes, \"0 0\". The first line of each dataset contains the maximum coordinate N and the number of total moves M where 3 \u0026lt; N \u0026lt; 21, 4 \u0026lt; M \u0026lt; 250, and M is odd. The rest of the dataset contains a total of M coordinate pairs, with one or more pairs per line. All numbers on a line will be separated by a space. M being odd means that Black will always be the last player. All data will be legal. There will never be a winning move before the last move. "}},{"title":"Output","value":{"format":"HTML","content":"The output contains one line for each data set: \"yes\" if the last move is a winning move and \"no\" otherwise."}},{"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 5\r\n0 2 2 4 4 2 3 2 2 3\r\n4 5\r\n0 2 2 4 4 2 3 2 2 1\r\n7 11\r\n0 3 6 5 3 2 5 7 7 2 4 4\r\n5 3 5 2 4 5 4 0 2 4\r\n0 0\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eno\r\nyes\r\nyes\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}