Ricefield#1983

Ricefield

1 second
64 megabytes
Very easy

Once, while traveling in fairyland, the Rabbit saw a rice field in one of the valleys. The field occupies the whole valley, which is a rectangle of M \times N cells. The Rabbit was very impressed by the complex structure of that field. It consisted of individual plots, each plot being located at its own level. Since the size of the field is very large, the Rabbit asks you to help him find the portions of the field with the largest and the smallest area.

Input

The first line of the input file contains two numbers and (1 \leq M, N \leq 100). The following lines each contain numbers separated by a space, forming the description map. Each cell contains an integer p_i (0 \leq p_i < 100), which indicates at what level the site is located. A site is a collection of cells in the field that are located on the same level and are connected with other cells of the same level in any direction.

Output

Output two numbers separated by a space: the maximum and minimum land area.

Examples

Example 1

Loading
Loading