semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
    int m, n;
    scanf("%d %d",&m, &n);
    int a=m+2;
    int b=n+2;
    int sz[a][b];
    for(int i=0;i<a;i++){
        for(int j=0;j<b;j++){
            sz[i][j]=0;
        }
    }
    for(int i=1;i<a-1;i++){
        for(int j=1;j<b-1;j++){
            scanf("%d",&sz[i][j]);
        }
    }
    for(int i=1;i<a-1;i++){
        for(int j=1;j<b-1;j++){
            if(sz[i][j]>=sz[i-1][j]&&sz[i][j]>=sz[i+1][j]&&sz[i][j]>=sz[i][j+1]&&sz[i][j]>=sz[i][j-1]){
                int c=i-1;
                int d=j-1;
                printf("%d %d\n",c, d);
            }
        }
    }
    return 0;
}
int main(){
	int m,n;
	cin>>m>>n;
	int high[21][21];
	int i,j;
	for(i=0;i<m;i++)
		for(j=0;j<n;j++)
			cin>>high[i][j];
	for(i=0;i<m;i++)
		for(j=0;j<n;j++)
		{
			if(i==0&&j==0)
			{
				if(high[i][j]>=high[i][j+1]&&high[i][j]>=high[i+1][j])
					cout<<i<<' '<<j<<endl;
			}
		    else if(i==0&&j==n-1)
			{
				if(high[i][j]>=high[i+1][j]&&high[i][j]>=high[i][j-1])
					cout<<i<<' '<<j<<endl;
			}
			else if(i==m-1&&j==n-1)
			{
				if(high[i][j]>=high[i-1][j]&&high[i][j]>=high[i][j-1])
					cout<<i<<' '<<j<<endl;
			}
			else if(i==m-1&&j==0)
			{
				if(high[i][j]>=high[i-1][j]&&high[i][j]>=high[i][j+1])
					cout<<i<<' '<<j<<endl;
			}
			else if(i==0&&j>0&&j<n-1)
			{
				if(high[i][j]>=high[i+1][j]&&high[i][j]>=high[i][j-1]&&high[i][j]>=high[i][j+1])
					cout<<i<<' '<<j<<endl;
			}
			else if(i==m-1&&j>0&&j<n-1)
			{
                if(high[i][j]>=high[i-1][j]&&high[i][j]>=high[i][j-1]&&high[i][j]>=high[i][j+1])
					cout<<i<<' '<<j<<endl;
			}
			else if(i>0&&i<m-1&&j==0)
			{
				if(high[i][j]>=high[i+1][j]&&high[i][j]>=high[i-1][j]&&high[i][j]>=high[i][j+1])
					cout<<i<<' '<<j<<endl;
			}
			else if(i>0&&i<m-1&&j==n-1)
			{
				if(high[i][j]>=high[i+1][j]&&high[i][j]>=high[i-1][j]&&high[i][j]>=high[i][j-1])
					cout<<i<<' '<<j<<endl;
			}
			else
				if(high[i][j]>=high[i+1][j]&&high[i][j]>=high[i-1][j]&&high[i][j]>=high[i][j-1]&&high[i][j]>=high[i][j+1])
					cout<<i<<' '<<j<<endl;
		}
		return 0;
}
int main(){
    int m,n ;
    
    int sz[1000][1000];
    scanf("%d%d",&m,&n);
    for(int i=0;i<n+2;i++){sz[0][i]=0;}
    for(int i=1;i<m+1;i++){
        for(int a=1;a<n+1;a++){
            scanf("%d",&sz[i][a]);
        }
    }
    for(int i=0;i<m+2;i++){sz[i][0]=0;}
    for(int i=0;i<m+2;i++){sz[i][n+1]=0;}
    for(int i=0;i<n+2;i++){sz[m+1][i]=0;}
    for(int i=1;i<m+1;i++){
       for(int a=1;a<n+1;a++){
           if(sz[i][a]>=sz[i-1][a]&&sz[i][a]>=sz[i+1][a]&&sz[i][a]>=sz[i][a+1]&&sz[i][a]>=sz[i][a-1]){
            printf("%d ",i-1);
           printf("%d\n",a-1);
           }
       }
      } 
     return 0;    
}
int main(int argc, char* argv[])
{
	int a[MAX+1][MAX+1]={0};
	int m,n,i,j;
	scanf("%d %d",&m,&n);
	for(i=1;i<=m;i++){
		for(j=1;j<=n;j++){
			scanf("%d",&a[i][j]);
		}
	}
	for(i=1;i<=m;i++){
		for(j=1;j<=n;j++){
			if(a[i][j]>=a[i-1][j]&&a[i][j]>=a[i+1][j]&&a[i][j]>=a[i][j-1]&&a[i][j]>=a[i][j+1]){
				printf("%d %d\n",i-1,j-1);
			}
		}
	}
	return 0;
}
int main()
{
	int num[20][21]={0},*p=&num[0][0],m,n,i,k,flag=0;
	scanf("%d%d",&m,&n);
	for(i=0;i<m;i++)
	{
		for(k=0;k<n;k++)
			scanf("%d",p+21*i+k);
	}
	if(num[0][0]>=num[0][1]&&num[0][0]>=num[1][0])
	{
		printf("0 0");
		flag=1;
	}
	for(k=1;k<n;k++)
	{
		if(*(p+k)>=*(p+k+1)&&*(p+k)>=*(p+k-1)&&*(p+k)>=*(p+21+k))
		{
			if(flag)printf("\n");
			printf("0 %d",k);
			flag=1;
		}

	}
	for(i=1;i<m-1;i++)
	{
		for(k=0;k<n;k++)
		{
			if(*(p+21*i+k)>=*(p+21*i+k+1)&&*(p+21*i+k)>=*(p+21*i+k-1)&&*(p+21*i+k)>=*(p+21*(i-1)+k)&&*(p+21*i+k)>=*(p+21*(i+1)+k))
			{
				if(flag)printf("\n");
				printf("%d %d",i,k);
				flag=1;
			}
		}
	}
	for(k=0;k<n;k++)
		if(*(p+(m-1)*21+k)>=*(p+(m-1)*21+k+1)&&*(p+(m-1)*21+k)>=*(p+(m-1)*21+k-1)&&*(p+(m-1)*21+k)>=*(p+(m-2)*21+k))
		{
			if(flag)printf("\n");
			printf("%d %d",m-1,k);
			flag=1;
		}
	return 0;
}
int main()
{
	int n,q,i,j,a[30][30],m;
	int (*b)[30];
	b=a;
	cin>>n>>m;
	for(i=0;i<=n+1;i++)
	{
		for(j=0;j<=m+1;j++)
		{
			*(*(b+i)+j)=0;
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			cin>>*(*(b+i)+j);
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			if(*(*(b+i)+j)>=*(*(b+i+1)+j)&&*(*(b+i)+j)>=*(*(b+i-1)+j)&&*(*(b+i)+j)>=*(*(b+i)+j-1)&&*(*(b+i)+j)>=*(*(b+i)+j+1))
			{
				cout<<i-1<<" "<<j-1<<endl;
			}
		}
	}
	
    cin>>q;
    return 0;
}
int main()
{
	int m,n;
	cin >> m >> n;
	int i,j;
	int a[25][25];
	for(i = 0; i < 25; i ++)
	{
		for(j = 0;j < 25;j ++)
		{
			a[i][j] = 0;
		}
	}

	for(i = 1; i < m + 1; i ++)
	{
		for(j = 1; j < n + 1; j ++)
		{
			cin >> a[i][j];
		}
	}

	for(i = 1; i < m + 1; i ++)
	{
		for(j = 1; j < n + 1; j ++)
		{
			if( a[i][j] >= a[i-1][j] && a[i][j] >= a[i+1][j] && a[i][j] >= a[i][j-1] && a[i][j] >= a[i][j+1])
			{
				cout<< i - 1 << " " << j - 1 <<endl;
			}
		}
	}
}
//**************************************
//*???????                     
//*????? 1100012780     	        
//*???2011.12.30                     
//**************************************
int main()
{
	int m,n;
	cin >> m >> n;
	int i,j;
	int height[22][22] = {0};//??????????
	for (i = 1;i <= m;i++)//???????0?????????
		for (j = 1;j <= n;j++)
			cin >> height[i][j];
	int count = 0;//??????????????
	for (i = 1;i <= m;i++)
		for (j = 1;j <= n;j++)
			if (height[i][j] >= height[i - 1][j] && height[i][j] >= height[i + 1][j] &&
				height[i][j] >= height[i][j + 1] && height[i][j] >= height[i][j - 1])
			{
				count++;
			}
	for (i = 1;i <= m;i++)
		for (j = 1;j <= n;j++)
			if (height[i][j] >= height[i - 1][j] && height[i][j] >= height[i + 1][j] &&
				height[i][j] >= height[i][j + 1] && height[i][j] >= height[i][j - 1])
			{
				count--;
				cout << i - 1 << " " << j - 1;
				if (count != 0)
					cout<<endl;
			}
	return 0;
}
int main ()
{
    int n,m,i,j,sz[max][max];
    scanf("%d %d",&m,&n);
    for(i=0;i<m;i++)
    {
        for(j=0;j<n;j++)
        {
            scanf("%d",&sz[i][j]);
        }
    }
    for(i=0;i<m;i++)
    {
        for(j=0;j<n;j++)
        {
            if(i==0&&j==0)
            {
                if(sz[i][j]>=sz[i][j+1]&&sz[i][j]>=sz[i+1][j])
                   {
                    printf("%d %d\n",i,j);
                    }
            }
            else if(i==0&&j!=0&&j!=n-1)
            {
              if(sz[i][j]>=sz[i][j-1]&&sz[i][j]>=sz[i][j+1]&&sz[i][j]>=sz[i+1][j])
               {

                printf("%d %d\n",i,j);
               }
            }
            else if(i==0&&j==n-1)
            {
                if(sz[i][j]>=sz[i][j-1]&&sz[i][j]>=sz[i+1][j])
               {

                printf("%d %d\n",i,j);
               }

            }
            else if (i!=m-1&&j==n-1&&i!=0)
            {
                if(sz[i][j]>=sz[i-1][j]&&sz[i][j]>=sz[i+1][j]&&sz[i][j]>=sz[i][j-1])
                   {

                    printf("%d %d\n",i,j);
                   }
            }
            else if (i==m-1&&j==n-1)
            {
                if(sz[i][j]>=sz[i-1][j]&&sz[i][j]>=sz[i][j-1])
                   {

                    printf("%d %d\n",i,j);
                   }
            }
            else if(i==m-1&&j!=n-1&&j!=0)
            {
                if(sz[i][j]>=sz[i][j-1]&&sz[i][j]>=sz[i][j+1]&&sz[i][j]>=sz[i-1][j])
                   {

                    printf("%d %d\n",i,j);
                   }
            }
            else if(i==m-1&&j==0)
            {
                if(sz[i][j]>=sz[i][j+1]&&sz[i][j]>=sz[i-1][j])
                   {

                    printf("%d %d\n",i,j);
                   }
            }
            else if(i!=0&&j==0&&i!=m-1)
            {
                if(sz[i][j]>=sz[i+1][j]&&sz[i][j]>=sz[i-1][j]&&sz[i][j]>=sz[i][j+1])
                    {
                        printf("%d %d\n",i,j);
                    }
            }
            else if(sz[i][j]>=sz[i-1][j]&&sz[i][j]>=sz[i+1][j]&&sz[i][j]>=sz[i][j-1]&&sz[i][j]>=sz[i][j+1])
            {
                printf("%d %d\n",i,j);
            }
        }
    }
    return 0;
}
int main(){
    int m,n,i,j,k,a,b=0;
    int gao[1000][1000],din[1000][1000];
    scanf("%d%d",&m,&n);
    for(i=0;i<m;i++){
        for(j=0;j<n;j++){
            scanf("%d",&gao[i][j]);
        }
    }
    for(k=0;k<m;k++){
        for(a=0;a<n;a++){
            if((a!=0&&gao[k][a]>=gao[k][a-1]&&gao[k][a]>=gao[k][a+1]||a==0&&gao[k][a]>=gao[k][a+1])&&(k!=0&&gao[k][a]>=gao[k-1][a]&&gao[k][a]>=gao[k+1][a]||k==0&&gao[k][a]>=gao[k+1][a])){
               din[b][0]=k;
               din[b][1]=a;
               b++;       
            }else{
                continue;
       }
        }
    }
       
    for(int c=0;c<b;c++){
   for(int d=0;d<2;d++){
       if(d!=1){
       printf("%d ",din[c][d]);
       }else{
           printf("%d\n",din[c][d]);
       }
       
   }       
    }
    
    return 0;
}
int main(){
    int m, n;
    int a[22][22];
    int d, j, x, y;
    scanf("%d %d", &m, &n);
    for(d=1;d<=m;d++){
        for(j=1;j<=n;j++){
            scanf("%d", &a[d][j]);
        }
    }
    for(j=0;j<=n+1;j++)
      {a[0][j]=0;a[m+1][j]=0;}
    for(d=1;d<=m;d++)
      {a[d][0]=0;a[d][n+1]=0;}
    for(d=1;d<=m;d++){
        for(j=1;j<=n;j++){
            if(a[d][j]>=a[d-1][j]&&a[d][j]>=a[d+1][j]&&a[d][j]>=a[d][j-1]&&a[d][j]>=a[d][j+1]){
                x=d-1;y=j-1;
                printf("%d %d\n", x, y);
            }
        }
    }
    return 0;
}
int main ()
{
	int a[30][30]={0},m=0,n=0;
	cin >> m >> n;
	for (int i=0;i<m;i++)
		for (int j=0;j<n;j++)
			cin >> a[i][j];
	for (int i=0;i<m;i++)
		for (int j=0;j<n;j++)
		{
			if (i>=1&&a[i-1][j]>a[i][j]) continue;
			if (i<m-1&&a[i+1][j]>a[i][j]) continue;
			if (j>=1&&a[i][j-1]>a[i][j]) continue;
			if (j<n-1&&a[i][j+1]>a[i][j]) continue;
			cout <<i <<' ' <<j <<endl;
		}
		return 0;
}
int main(){
    int l,w,m,n;
    int high[50][50];
    scanf("%d%d",&l,&w);
    for(int i=0;i<l;i++){
        for(int k=0;k<w;k++){
            scanf("%d",&high[i][k]);
        }
    }
    for(int i=0;i<l;i++){
        for(int k=0;k<w;k++){
            if(i!=0&&k!=0&&i!=l-1&&k!=w-1){
                if(high[i][k]>=high[i][k-1]&&high[i][k]>=high[i][k+1]&&high[i][k]>=high[i-1][k]&&high[i][k]>=high[i+1][k]){
                    printf("%d %d\n",i,k);
                }
            }
           else if(i==0&&k==0){
               if(high[i][k]>=high[i][k+1]&&high[i][k]>=high[i+1][k]){ printf("%d %d\n",i,k);}
           }
           else if(i==0&&k==w-1){
               if(high[i][k]>=high[i+1][k]&&high[i][k]>=high[i][k-1]){ printf("%d %d\n",i,k);}
           }
           else if(i==l-1&&k==0){
               if(high[i][k]>=high[i][k+1]&&high[i][k]>=high[i-1][k]){ printf("%d %d\n",i,k);}
           }
           else if(i==l-1&&k==w-1){
               if(high[i][k]>=high[i-1][k]&&high[i][k]>=high[i][k-1]){ printf("%d %d\n",i,k);}
           }
            else if(i==0&&k!=0&&k!=w-1){
               if(high[i][k]>=high[i][k+1]&&high[i][k]>=high[i][k-1]&&high[i][k]>=high[i+1][k]){ printf("%d %d\n",i,k);}
           }
           else if(i==l-1&&k!=0&&k!=w-1){
               if(high[i][k]>=high[i][k+1]&&high[i][k]>=high[i][k-1]&&high[i][k]>=high[i-1][k]){ printf("%d %d\n",i,k);}
           }
           else if(k==0&&i!=0&&i!=l-1){
               if(high[i][k]>=high[i][k+1]&&high[i][k]>=high[i+1][k]&&high[i][k]>=high[i-1][k]){ printf("%d %d\n",i,k);}
           }
           else if(k==w-1&&i!=0&&i!=l-1){
               if(high[i][k]>=high[i][k-1]&&high[i][k]>=high[i+1][k]&&high[i][k]>=high[i-1][k]){ printf("%d %d\n",i,k);}
           }
        }
    }
    return 0;
}
int main()
{
	int m,n; cin>>m>>n;
	int a[m+2][n+2]; int i,j;
	for (i=0;i<n+2;i++) a[0][i]=0;
	for (i=0;i<n+2;i++) a[m+1][i]=0;
	for (i=0;i<m+2;i++) a[i][0]=0;
	for (i=0;i<m+2;i++) a[i][n+1]=0;
	for (i=1;i<=m;i++)
		for (j=1;j<=n;j++)
			cin>>a[i][j];
	for (i=1;i<=m;i++)
		for (j=1;j<=n;j++)
			if (a[i][j]>=a[i][j-1]&&a[i][j]>=a[i][j+1]&&a[i][j]>=a[i-1][j]&&a[i][j]>=a[i+1][j])
				cout<<i-1<<" "<<j-1<<endl;
	return 0;
}
int main(){
int m,n;
scanf("%d %d",&m,&n);
int x[m][n];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
scanf("%d",&x[i][j]);}
}

if((x[0][0]>=x[1][0])&&(x[0][0]>=x[0][1])){
printf("%d %d\n",0,0);}
for(int i=1;i<n-1;i++){
if((x[0][i]>=x[1][i])&&(x[0][i]>=x[0][i-1])&&(x[0][i]>=x[0][i+1])){
printf("%d %d\n",0,i);}
}
if((x[0][n-1]>=x[1][n-1])&&(x[0][n-1]>=x[0][n-2])){
printf("%d %d\n",0,n-1);}

for(int j=1;j<m-1;j++){

if((x[j][0]>=x[j+1][0])&&(x[j][0]>=x[j][1])&&(x[j][0]>=x[j-1][0])){
printf("%d %d\n",j,0);}
for(int k=1;k<n-1;k++){
if((x[j][k]>=x[j+1][k])&&(x[j][k]>=x[j][k-1])&&(x[j][k]>=x[j][k+1])&&(x[j][k]>=x[j-1][k])){
printf("%d %d\n",j,k);  }
}
if((x[j][n-1]>=x[j+1][n-1])&&(x[j][n-1]>=x[j][n-2])&&(x[j][n-1]>=x[j-1][n-1])){
printf("%d %d\n",j,n-1);}
}



if((x[m-1][0]>=x[m-2][0])&&(x[m-1][0]>=x[m-1][1])){
printf("%d %d\n",m-1,0);}
for(int i=1;i<n-1;i++){
if((x[m-1][i]>=x[m-2][i])&&(x[m-1][i]>=x[m-1][i-1])&&(x[m-1][i]>=x[m-1][i+1])){
printf("%d %d\n",m-1,i);}
}
if((x[m-1][n-1]>=x[m-2][n-1])&&(x[m-1][n-1]>=x[m-1][n-2])){
printf("%d %d\n",m-1,n-1);}

return 0;
}
int due(int high[22][22],int i,int j)
{
	int z=1;
	if(high[i][j]>=high[i][j-1]&&high[i][j]>=high[i][j+1]&&high[i][j]>=high[i+1][j]&&high[i][j]>=high[i-1][j])
		z=0;
	return(z);
}
int main()
{
	int i,j,n,m,high[22][22];
	scanf("%d%d",&m,&n);
	for(i=1;i<=m;i++)
	{
		for(j=1;j<=n;j++)
		{
			scanf("%d",&high[i][j]);
		}
	}
	for(j=0;j<=n+1;j++)  high[0][j]=0;
	for(i=0;i<=m+1;i++)  high[i][0]=0;
	for(j=0;j<=n+1;j++)  high[m+1][j]=0;
	for(i=0;i<=m+1;i++)  high[i][n+1]=0;
	for(i=1;i<=m;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(due(high,i,j)==0)
				printf("%d %d\n",i-1,j-1);
		}
	}
}
int main(){
	int m,n;
	scanf("%d%d",&m,&n);
	int shan[m+2][n+2];
        for(int i=0;i<=m+1;i++){
		for(int j=0;j<=n+1;j++){
			shan[i][j]=0;
		}
	}
	for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			scanf("%d",&shan[i][j]);
		}
	}
	for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			if((shan[i][j]>=shan[i-1][j])&&(shan[i][j]>=shan[i][j-1])&&(shan[i][j]>=shan[i+1][j])&&(shan[i][j]>=shan[i][j+1])){
				printf("%d %d\n",i-1,j-1);
			}
		}
	}
	return 0;

}
int peak(int a[MAX][MAX],int i,int j)
{
	if(a[i][j]>=a[i-1][j]
		&&a[i][j]>=a[i+1][j]
		&&a[i][j]>=a[i][j-1]
		&&a[i][j]>=a[i][j+1])
		return 1;
	else
		return 0;
}

void main()
{
	int a[MAX][MAX],m,n,i,j;
	for(i=0;i<MAX;i++)
		for(j=0;j<MAX;j++)
			a[i][j]=0;

	scanf("%d%d",&m,&n);
	for(i=1;i<=m;i++)
		for(j=1;j<=n;j++)
			scanf("%d",&a[i][j]);

	for(i=1;i<=m;i++)
		for(j=1;j<=n;j++)
			if(peak(a,i,j)){
				printf("%d %d\n",i-1,j-1);
			}
}
int main()
{
	int m, n,x,y,i,j,sz[N][N];
	scanf("%d%d",&m,&n);
	for(i=1;i<=m;i++)
	{
		for(j=1;j<=n;j++)
		{
			scanf("%d",&(sz[i][j]));
		}
	}
	for(i=0,j=0;j<=n+1;j++)
	{
		sz[0][j]=0;
	}
	for(i=m+1,j=0;j<=n+1;j++)
	{
		sz[m+1][j]=0;
	}
	for(i=0,j=0;i<=m+1;i++)
	{
		sz[i][0]=0;
	}
	for(i=0,j=n+1;i<=m+1;i++)
	{
		sz[i][n+1]=0;
	}

	for(i=1;i<=m;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(sz[i][j-1]<=sz[i][j]&&sz[i][j+1]<=sz[i][j]&&sz[i-1][j]<=sz[i][j]&&sz[i+1][j]<=sz[i][j])
			{
				x=i-1;y=j-1;
				printf("%d %d\n",x,y);
			}
		}
	}
	return 0;
}
int main()
{
 	int m,n;
 	int sz[ROW][COL];
 	int row,col;
	scanf("%d %d",&m,&n);
 	for(row=0;row<m;row++){
			for(col=0;col<n;col++){
				scanf("%d",&sz[row][col]);
				}
			}
	for(row=0;row<m;row++){
		for(col=0;col<n;col++){
			if(row==0&&col==0){
				if(sz[row][col]>=sz[row+1][col]&&sz[row][col]>=sz[row][col+1]){
					printf("%d %d\n",row,col);
					}
				}
			else if(row==0&&col==n-1){
				if(sz[row][col]>=sz[row+1][col]&&sz[row][col]>=sz[row][col-1]){
					printf("%d %d\n",row,col);
					}
				}
			else if(row==m-1&&col==0){
				if(sz[row][col]>=sz[row-1][col]&&sz[row][col]>=sz[row][col+1]){
					printf("%d %d\n",row,col);
					}
				}
			else if(row==m-1&&col==n-1){
				if(sz[row][col]>=sz[row][col-1]&&sz[row][col]>=sz[row-1][col]){
					printf("%d %d\n",row,col);
					}
				}
			else if(row==0){
				if(sz[row][col]>=sz[row+1][col]&&sz[row][col]>=sz[row][col-1]&&sz[row][col]>=sz[row][col+1]){
					printf("%d %d\n",row,col);
					}
				}
			else if(row==m-1){
				if(sz[row][col]>=sz[row-1][col]&&sz[row][col]>=sz[row][col-1]&&sz[row][col]>=sz[row][col+1]){
				    printf("%d %d\n",row,col);
				    }
				}
			else if(col==0){
				if(sz[row][col]>=sz[row-1][col]&&sz[row][col]>=sz[row+1][col]&&sz[row][col]>=sz[row][col+1]){
					printf("%d %d\n",row,col);
					}
				}
			else if(col==n-1){
				if(sz[row][col]>=sz[row-1][col]&&sz[row][col]>=sz[row+1][col]&&sz[row][col]>=sz[row][col-1]){
					printf("%d %d\n",row,col);
					}
				}
			else if(row!=0&&row!=m-1&&col!=0&&col!=n-1){
			if(sz[row][col]>=sz[row-1][col]&&sz[row][col]>=sz[row+1][col]&&sz[row][col]>=sz[row][col-1]&&sz[row][col]>=sz[row][col+1]){
				printf("%d %d\n",row,col);
				}
		    }
			}
		}
	
 	
    return 0;
}
int main()
{int m=0,n=0;int a[21][21]={0};int i=0,j=0;
cin>>m>>n;
for(i=1;i<=m;i++)
	for(j=1;j<=n;j++)
		cin>>a[i][j];
for(i=1;i<=m;i++)
	for(j=1;j<=n;j++)
		if(a[i][j]>=a[i-1][j]&&a[i][j]>=a[i+1][j]&&a[i][j]>=a[i][j+1]&&a[i][j]>=a[i][j-1])
			cout<<i-1<<" "<<j-1<<endl;
cin.get();cin.get();
return 0;
}
int mat[22][22]={0};
void main()
{
	int l,w,m,n,count;
	count=0;
	scanf("%d%d", &l, &w);
	for(m=1;m<=l;m++)
	{
		for(n=1;n<=w;n++)
		{
			scanf("%d", &mat[m][n]);
		}
	}
    for(m=1;m<=l;m++)
	{
		for(n=1;n<=w;n++)
		{
		
			if(mat[m][n]<mat[m][n-1]) count++;
		    if(mat[m][n]<mat[m-1][n]) count++;
			if(mat[m][n]<mat[m+1][n]) count++;
			if(mat[m][n]<mat[m][n+1]) count++;
			if(count==0) 
			{
				printf("%d %d\n", m-1, n-1);
			}
            count=0;
		}
	}
}
int main()
{
    int m,n,i,j,t,r,s,a[30][30];
    scanf("%d %d",&m,&n);
    for(i=0;i<=m+1;i++)
        for(j=0;j<=n+1;j++)
            a[i][j]=0;
    for(i=1;i<=m;i++)
        for(j=1;j<=n;j++)
            scanf("%d",&a[i][j]);
    for(i=1;i<=m;i++)
        for(j=1;j<=n;j++)
            {
                
                if(  (a[i][j]>=a[i-1][j]) && (a[i][j]>=a[i][j-1]) && (a[i][j]>=a[i+1][j]) && (a[i][j]>=a[i][j+1]) )
                    printf("%d %d\n",i-1,j-1);
            }
    getchar();
}
int main(){
    int a[101][101]={0};
    int x,y,h=0,i,m,n;
    scanf("%d%d",&m,&n);
    for(x=1;x<m+1;x++){
        for(y=1;y<n+1;y++){
            scanf("%d",&a[x][y]);
        }
    }
    for(x=1;x<m+1;x++){
        for(y=1;y<n+1;y++){
            if(a[x][y]>=a[x][y-1]&&a[x][y]>=a[x][y+1]&&a[x][y]>=a[x+1][y]&&a[x][y]>=a[x-1][y]){
                printf("%d %d\n",x-1,y-1);
            }
        }
    }
    return 0;
}
int main()
{
int a[20][20];
int m,n,i,j;
scanf("%d%d",&m,&n);
for(i=0;i<m;i++)
{for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<m;i++)
{for(j=0;j<n;j++)
{if(i==0&&j==0&&a[i][j]>=a[i][j+1]&&a[i][j]>=a[i+1][j])
 printf("%d %d\n",i,j);
 else if(i==0&&j!=(n-1)&&a[i][j]>=a[i][j-1]&&a[i][j]>=a[i][j+1]&&a[i][j]>=a[i+1][j])
 printf("%d %d\n",i,j);
else if(i==0&&j==(n-1)&&a[i][j]>=a[i][j-1]&&a[i][j]>=a[i+1][j])
printf("%d %d\n",i,j);
else if(j==0&&i!=(m-1)&&i!=0&&a[i][j]>=a[i][j+1]&&a[i][j]>=a[i+1][j]&&a[i][j]>=a[i-1][j])
printf("%d %d\n",i,j);
else if(j==0&&i==(m-1)&&a[i][j]>=a[i][j+1]&&a[i][j]>=a[i-1][j])
printf("%d %d\n",i,j);
else if(i!=0&&i!=(m-1)&&j==(n-1)&&a[i][j]>=a[i][j-1]&&a[i][j]>=a[i-1][j]&&a[i][j]>=a[i+1][j])
printf("%d %d\n",i,j);
else if(i==(m-1)&&j!=0&&j!=(n-1)&&a[i][j]>=a[i][j-1]&&a[i][j]>=a[i][j+1]&&a[i][j]>=a[i-1][j])
printf("%d %d\n",i,j);
else if(i==(m-1)&&j==(n-1)&&a[i][j]>=a[i][j-1]&&a[i][j]>=a[i-1][j])
printf("%d %d\n",i,j);
else if(a[i][j]>=a[i-1][j]&&a[i][j]>=a[i+1][j]&&a[i][j]>=a[i][j-1]&&a[i][j]>=a[i][j+1])
 printf("%d %d\n",i,j);
}}
return 0;
}
int main()
{
	int com(int a[][100],int x,int y);
	int m,n,b;
	int a[100][100]={0},i,j;
	scanf("%d%d",&m,&n);
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{	scanf("%d",&a[i][j]);}
	}

	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			b=com(a,i,j);
			if(b>0)
			{
				printf("%d %d\n",i,j);
			}
		}
	}
	return 0;
}

int com(int a[][100],int x,int y)
{
	int b=0;
	if(x==0)
	{
		if(y==0)
		{
			if(a[x][y]>=a[x+1][y]&&a[x][y]>=a[x][y+1])
				b=1;

		}
		else
		{
			if(a[x][y]>=a[x+1][y]&&a[x][y]>=a[x][y+1]&&a[x][y]>=a[x][y-1])
				b=1;
		}
	}
	else
	{
		if(y==0)
		{
			if(a[x][y]>=a[x+1][y]&&a[x][y]>=a[x][y+1]&&a[x][y]>=a[x-1][y])
				b=1;

		}
		else
		{
			if(a[x][y]>=a[x-1][y]&&a[x][y]>=a[x+1][y]&&a[x][y]>=a[x][y+1]&&a[x][y]>=a[x][y-1])
				b=1;
		}
	}
	return(b);
}
int main(int argc, char* argv[])
{
	int m,n,i,j;
	int high[80][80];
	scanf("%d%d",&m,&n);
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			scanf("%d",&high[i][j]);
		}
	}
	
	//???
	i=0;
	j=0;
	if((high[0][0]>=high[0][1])&&(high[0][0]>=high[1][0]))
		printf("%d %d\n",i,j);
	for(j=1;j<n-1;j++)
	{
		if((high[0][j]>=high[0][j-1])&&(high[0][j]>=high[0][j+1])&&(high[0][j]>=high[1][j]))
			printf("%d %d\n",i,j);
	}
	j=n-1;
	if ((high[0][j]>high[0][j-1])&&(high[0][j]>=high[1][j]))
		printf("%d %d\n",i,j);

	//????
	for(i=1;i<=m-2;i++)
	{
		j=0;
		
		if((high[i][0]>=high[i][1])&&(high[i][0]>=high[i+1][0])&&(high[i][0]>=high[i-1][0]))
			printf("%d %d\n",i,j);
		
		for(j=1;j<n-1;j++)
		{
			if((high[i][j]>=high[i][j-1])&&(high[i][j]>=high[i][j+1])&&(high[i][j]>=high[i-1][j])&&(high[i][j]>=high[i+1][j]))
				printf("%d %d\n",i,j);
		}
		j=n-1;
		
			if ((high[i][j]>high[i][j-1])&&(high[i][j]>=high[i-1][j])&&(high[i][j]>=high[i+1][j]))
				printf("%d %d\n",i,j);

		
	}

	//????
	i=m-1;
	j=0;
	if((high[i][0]>=high[i][1])&&(high[i][0]>=high[i-1][0]))
		printf("%d %d\n",i,j);
	for(j=1;j<=n-2;j++)
	{
		if((high[i][j]>=high[i][j-1])&&(high[i][j]>=high[i][j+1])&&(high[i][j]>=high[i-1][j]))
			printf("%d %d\n",i,j);
	}
	j=n-1;
	if ((high[i][j]>=high[i][j-1])&&(high[i][j]>=high[i-1][j]))
		printf("%d %d\n",i,j);
	return 0;
}
int main(){
    int m,n;
    scanf("%d %d",&m,&n);
    char mtn[m][n];
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            scanf("%d",&mtn[i][j]);
        }
    }
    for(int row=0;row<m;row++){
        for(int col=0;col<n;col++){
            if(row==0&&col==0&&mtn[row][col]>=mtn[row+1][col]&&mtn[row][col]>=mtn[row][col+1]){printf("%d %d\n",row,col);}
            else if((row==m-1)&&(col==0)&&(mtn[row][col]>=mtn[row-1][col])&&(mtn[row][col]>=mtn[row][col+1])){printf("%d %d\n",row,col);}
            else if((row==0)&&(col==n-1)&&(mtn[row][col]>=mtn[row][col-1])&&(mtn[row][col]>=mtn[row+1][col])){printf("%d %d\n",row,col);}            
            else if((row==m-1)&&(col==n-1)&&(mtn[row][col]>=mtn[row-1][col])&&(mtn[row][col]>=mtn[row][col-1])){printf("%d %d\n",row,col);}      
            else if((row==0)&&(mtn[row][col]>=mtn[row][col+1])&&(mtn[row][col]>=mtn[row][col-1])&&(mtn[row][col]>=mtn[row+1][col])){printf("%d %d\n",row,col);} 
            else if((row==m-1)&&(mtn[row][col]>=mtn[row][col-1])&&(mtn[row][col]>=mtn[row][col+1])&&(mtn[row][col]>=mtn[row-1][col])){printf("%d %d\n",row,col);} 
            else if((col==0)&&(row!=m-1)&&(row!=0)&&(mtn[row][col]>=mtn[row-1][col])&&(mtn[row][col]>=mtn[row+1][col])&&(mtn[row][col]>=mtn[row][col+1])){printf("%d %d\n",row,col);} 
            else if((col==n-1)&&(row!=m-1)&&(row!=0)&&(mtn[row][col]>=mtn[row-1][col])&&(mtn[row][col]>=mtn[row+1][col])&&(mtn[row][col]>=mtn[row][col-1])){printf("%d %d\n",row,col);} 
            else if((row!=0)&&(row!=m-1)&&(col!=0)&&(col!=n-1)&&(mtn[row][col]>=mtn[row-1][col])&&(mtn[row][col]>=mtn[row+1][col])&&(mtn[row][col]>=mtn[row][col-1])&&(mtn[row][col]>=mtn[row][col+1])){printf("%d %d\n",row,col);} 

        }
        }
return 0;

}
int main()
{
int sz[255][255];
int m,n,a,i,j,row,col;
a=0;
scanf("%d %d",&m,&n);
for(row=0;row<m;row++){
	for(col=0;col<n;col++){
		scanf("%d",&sz[row][col]);
	}
}
for(i=0;i<m;i++){
	for(j=0;j<n;j++){
		if(sz[i][j]-sz[i][j+1]>=0&&sz[i][j]-sz[i][j-1]>=0&&sz[i][j]-sz[i-1][j]>=0&&sz[i][j]-sz[i+1][j]>=0)
		printf("%d %d\n",i,j);
	}
}


return 0;
}