门
#include <bits/stdc++.h>
using namespace std;
int n, m, a[105][105], ans, s[105][105];
int dx[5] = {0, 0, 1, -1};
int dy[5] = {1, -1, 0, 0};
int dfs(int x, int y){
if(s[x][y] != 0) return s[x][y];
s[x][y] = 1;
for (int i = 0; i < 4; i++){
int xx = dx[i] + x, yy = dy[i] + y;
if(xx < 1 || yy < 1 || xx > n || yy > m){
if(a[x][y] <= a[xx][yy]){
continue;
}
}
dfs(xx, yy);
s[x][y] = max(s[x][y], s[xx][yy] + 1);
}
return s[x][y];
}
int main(){
cin >> n >> m;
for (int i = 1; i <= n; i++){
for (int j = 1; j <= m; j++){
cin >> a[i][j];
}
}
for (int i = 1; i <= n; i++){
for (int j = 1; j <= m; j++){
ans = max(ans, dfs(i, j));
}
}
cout << ans;
return 0;
}