+ محدودیت زمان: ۱ ثانیه
+ محدودیت حافظه: ۲۵۶ مگابایت
----------
Erfan wants to draw a painting on an $n \times m$ board. He can draw some strips on the board using a paintbrush of width $1$. 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.
![توضیح تصویر](https://quera.org/qbox/view/zfi8gPOHt5/C.png)
# input
There are multiple test cases in the input. The first line of each test case contains two integers $n$ and $m$ which indicate the count of rows and columns of the board, respectively
Following the first line, there are $n$ lines with $m$ integers $c_{i, j}$($1 \leq i \leq n, 1 \leq j \leq m$) denoting the color in each cell.
$$1 \leq n, m \leq 100$$
$$1 \leq c_{i, j} \leq 1000$$
# output
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).
# example
### sample input 1
```
4 4
1 5 4 3
6 5 6 6
2 2 2 2
1 5 4 3
```
### sample output 1
```
1 3 4 6 5 2
```
### sample input 2
```
3 2
1 1
2 3
2 3
```
### sample output 2
```
2 3 1
```
ارسال پاسخ برای این سؤال
در حال حاضر شما دسترسی ندارید.