Move zero elements down#9568

Move zero elements down

1 second
64 megabytes
Easy

Given a two-dimensional array of size n \times m, shift all zero elements in each column downwards, so that all zeros in each column are moved to the bottom of their column, while maintaining the order of the other (nonzero) elements.

Input

The first line contains two integers and — the number of rows and columns, respectively.

The following lines each contain integers, representing the elements of the array.

Output

Output the modified array after all zeros have been moved down in each column.

Examples

Example 1

Loading
Loading