There are many countries in a map. Each of them has a unique ID, which is a positive integer. All of them want to expand their territories. A country can expand its territory if its neighboring land (up, down, left, and right) has not been occupied by any other countries. The speeds of expanding territories of all countries are the same. If two or more countries want to occupy the same land, the country with the smaller ID can occupy the land. The expansion stops if no changes of the map can be made.
The input file begins with an integer T (1 < T < 1000), indicating the number of test cases. Each test case begins with two integers N and M (0 < N < 300, 0 < M < 300), indicating the height and the width of the map. Next N lines specify the occupancy of the map. The number 0 means the land has not been occupied, and the number > 0 denotes the country ID, which is smaller than 10.
For each case, output the final occupancy map. Print a blank after each case.