
Ethan wants to paint a picture on an m×n board. His brush is one cell wide, and on every step he picks a color he has not used yet and paints one whole row or one whole column. A color painted later completely covers the color underneath it.
The finished picture is already fixed, but Ethan does not know which color to start with. Read the finished picture and recover the order in which the colors were painted.
The input holds several test cases. The first line of each test case has two integers m and n, the size of the board (0<m,n<100). The next m lines hold n integers each, the color of every cell. Every color is a positive integer smaller than 10000.
The last line of the input holds two zeros.
Every picture given can really be painted by the rule above, and every color that was used is still visible in the finished picture.
For each test case, print the order in which the colors were painted on one line, separated by single spaces.
When several orders are possible, print the lexicographically smallest one. Treat each color number as one symbol: compare the two orders position by position, and the order whose color number is smaller at the first differing position comes first.