این مسابقه در تاریخ پنج شنبه ۱۴ دی به صورت حضوری در سایت دانشکده برق و کامپیوتر دانشگاه تهران برگزار شد.
Erfan wants to draw a painting on an board. He can draw some strips on the board using a paintbrush of width . In each step, he must choose a new color and paint a full column or a full row. He wants to draw an image on the board, but he doesn’t know which color to use first. You must help him find out the order of the colors.
There are multiple test cases in the input. The first line of each test case contains two integers and which indicate the count of rows and columns of the board, respectively Following the first line, there are lines with integers () denoting the color in each cell.
For each test case, write a single line containing the order of colors used to paint the board. If there are several answers, output the one which is lexicographically smallest (considering each number as a symbol).