
ski
The figure above represents a simplified map of some highland in a form of a matrix.
The numbers show the altitudes of the locations. We like skiing and we are searching for
a good path. A path through the highland is called good if the subsequent locations are
horizontally or vertically (but not diagonally) adjacent and each of them has a
strictly lower altitude than the previous one.
In the figure the path that starts at 11 and follows the green arrows, is a sequence of the locations
(2,4),(2,5),(2,6),(3,6),(3,5),(4,5),(4,4),(4,3) , where the first and second
number are the row and column index respectively.
Easy to verify that it is a good path, as well as the red one is. The length of
a path is the number of locations in it.
The green path is of length 8 and the red one is of length 7.
Your task is to compute the length of the longest good path for a given map.
Input Specification
R C
t_{11} ... t_{1C}
t_{21} ... t_{2C}
...
t_{R1} ... t_{RC}
The comma separated numbers 1 ≤ R,C ≤ 100 in the first row are the number of rows and columns
of the map  respectively. In each of the subsequent R rows there are C
comma separated positive integers, not larger than 10^{6} .
Output Specification
L
A single line with length L of the longest good path.
Sample Input 1
2 2 1 2 3 4
download as text file
Sample Output 1
3
download as text file
Sample Input 2
3 4 1 2 3 3 4 5 4 2 7 6 5 6
download as text file
Sample Output 2
7
download as text file
Sample Input 3
4 6 3 5 7 4 4 2 4 3 9 11 8 7 1 2 4 8 5 6 4 1 1 2 3 10
download as text file
Sample Output 3
8
download as text file

