{"trustable":true,"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\"\u003eOn Octorber 21st, HDU 50-year-celebration, 50-color balloons floating around the campus, it\u0027s so nice, isn\u0027t it? To celebrate this meaningful day, the ACM team of HDU hold some fuuny games. Especially, there will be a game named \"crashing color balloons\".\u003cbr\u003e\u003cbr\u003eThere will be a n*n matrix board on the ground, and each grid will have a color balloon in it.And the color of the ballon will be in the range of [1, 50].After the referee shouts \"go!\",you can begin to crash the balloons.Every time you can only choose one kind of balloon to crash, we define that the two balloons with the same color belong to the same kind.What\u0027s more, each time you can only choose a single row or column of balloon, and crash the balloons that with the color you had chosen. Of course, a lot of students are waiting to play this game, so we just give every student k times to crash the balloons.\u003cbr\u003e\u003cbr\u003eHere comes the problem: which kind of balloon is impossible to be all crashed by a student in k times.\u003cbr\u003e\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/1be14967e0ec58fec48ba600dede7624?v\u003d1713629445\"\u003e\u003c/center\u003e\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There will be multiple input cases.Each test case begins with two integers n, k. n is the number of rows and columns of the balloons (1 \u0026lt;\u003d n \u0026lt;\u003d 100), and k is the times that ginving to each student(0 \u0026lt; k \u0026lt;\u003d n).Follow a matrix A of n*n, where Aij denote the color of the ballon in the i row, j column.Input ends with n \u003d k \u003d 0.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, print in ascending order all the colors of which are impossible to be crashed by a student in k times. If there is no choice, print \"-1\".\u003cbr\u003e"}},{"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 1\r\n1\r\n2 1\r\n1 1\r\n1 2\r\n2 1\r\n1 2\r\n2 2\r\n5 4\r\n1 2 3 4 5\r\n2 3 4 5 1\r\n3 4 5 1 2\r\n4 5 1 2 3\r\n5 1 2 3 4\r\n3 3\r\n50 50 50\r\n50 50 50\r\n50 50 50\r\n0 0\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e-1\r\n1\r\n2\r\n1 2 3 4 5\r\n-1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}