semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
	int m,n,i,j;
	scanf("%d%d",&m,&n);
	int a[22][22];
	for(i=1;i<=m;i++)
		for(j=1;j<=n;j++)
		{
			scanf("%d",&a[i][j]);
		}
		for(j=1;j<n+1;j++)
		{
			a[0][j]=0;
			a[m+1][j]=0;
		}
		for(i=1;i<m+1;i++)
		{
			a[i][0]=0;
			a[i][n+1]=0;
		}
		a[0][0]=0;a[0][n+1]=0;a[m+1][0]=0;a[m+1][n+1]=0;
    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])
				printf("%d %d\n",i-1,j-1);
		}
}
int main(){
	int m,n,tmp,array[20][20],i,j;
	scanf("%d%d",&m,&n);
	for (i=0;i<m;i++)
		for (j=0;j<n;j++)
			scanf("%d",&(array[i][j]));
	for (i=0;i<m;i++)
		for (j=0;j<n;j++)
			{
			tmp=0;
			if ((i==0)||(array[i][j]>=array[i-1][j]))
				tmp++;
			if ((j==0)||(array[i][j]>=array[i][j-1]))
				tmp++;
			if ((i==m-1)||(array[i][j]>=array[i+1][j]))
				tmp++;
			if ((j==n-1)||(array[i][j]>=array[i][j+1]))
				tmp++;
			if (tmp==4)
				printf("%d %d\n",i,j);
			}
	return 0;
}
int main()
{
	int m, n, i, j, a[100][100] = {0};
	cin >> m >> n;
	for(i = 0;i < m;i++)
		for(j = 0;j < n;j++)
			cin >> a[i][j];
	for(i = 0;i < m;i++)
		for(j = 0;j < n;j++)
		{
			if(i == 0)
			{
                 if(a[i][j] >= a[i+1][j] && a[i][j] >= a[i][j-1] && a[i][j] >= a[i][j+1])
					 cout <<i <<' '<<j <<endl;
			}
			else if(j == 0)
			{
				if(a[i][j] >= a[i+1][j] && a[i][j] >= a[i-1][j]  && a[i][j] >= a[i][j+1])
					 cout <<i<<' '<<j<<endl;
			}
			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])
				   cout << i <<' '<<j<<endl;
		}
		return 0;
}
int main()
{
	int s[100][100],m,n,i,j,k,l;
	cin>>m>>n;
	for(i=1;i<=m;i++)
	{
		for(j=1;j<=n;j++)
		{
			cin>>s[i][j];
		}
	}
	for(k=1;k<=m;k++)
	{
		for(l=1;l<=n;l++)
		{
			if(  (s[k][l]>=s[k-1][l])  &&  (s[k][l]>=s[k][l-1])  &&  (s[k][l]>=s[k+1][l])  &&  (s[k][l]>=s[k][l+1])  )
			{
				cout<<k-1<<" "<<l-1<<endl;
			}
		}
	}
	return 0;
}
int main()
{
    int m,n,a[20][20],i,j;
    scanf("%d %d",&m,&n);
    for(i=0;i<m;i++)
    {
                    for(j=0;j<n;j++)
                    {
                                    scanf("%d",&a[i][j]);
                    }
    }
    if((a[0][0]>=a[0][1])&&(a[0][0]>=a[1][0]))
    printf("0 0\n");
    for(j=1;j<n-1;j++)
    {
                       if((a[0][j]>=a[0][j-1])&&(a[0][j]>=a[0][j+1])&&(a[0][j]>=a[1][j]))
                       printf("%d %d\n",0,j);
    }
    if((a[0][n-1]>=a[0][n-2])&&(a[0][n-1]>=a[1][n-1]))
    printf("%d %d\n",0,n-1);
    for(i=1;i<m-1;i++)
    {
                       if((a[i][0]>=a[i][1])&&(a[i][0]>=a[i-1][0])&&(a[i][0]>=a[i+1][0]))
                       printf("%d %d\n",i,0);
                       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]))
                                          printf("%d %d\n",i,j);
                       }
                       if((a[i][n-1]>=a[i][n-2])&&(a[i][n-1]>=a[i-1][n-1])&&(a[i][n-1]>=a[i+1][n-1]))
                       printf("%d %d\n",i,n-1);
    }
    if((a[m-1][0]>=a[m-1][1])&&(a[m-1][0]>=a[m-2][0]))
    printf("%d %d\n",m-1,0);
    for(j=1;j<n-1;j++)
    {
                       if((a[m-1][j]>=a[m-1][j-1])&&(a[m-1][j]>=a[m-1][j+1])&&(a[m-1][j]>=a[m-2][j]))
                       printf("%d %d\n",m-1,j);
    }
    if((a[m-1][n-1]>=a[m-1][n-2])&&(a[m-1][n-1]>=a[m-2][n-1]))
    printf("%d %d\n",m-1,n-1);
    getchar();
    getchar();
}
main()
{
	int m,n,i,j,a[20][20];
	scanf("%d%d",&m,&n);
	for(i=0;i<m;++i)
		for(j=0;j<n;++j)
			scanf("%d",&a[i][j]);
	if(!(a[0][0]<a[0][1]||a[0][0]<a[1][0]))
	
		printf("%d %d\n",0,0);
	for(i=1;i<n-1;++i)
		if(!(a[0][i]<a[0][i+1]||a[0][i]<a[0][i-1]||a[0][i]<a[1][i]))
		
			printf("%d %d\n",0,i);
	if(!(a[0][n-1]<a[0][n-2]||a[0][n-1]<a[1][n-1]))
	
		printf("%d %d\n",0,n-1);
	for(i=1;i<m-1;++i)
	{
		if(!(a[i][0]<a[i][1]||a[i][0]<a[i+1][0]||a[i][0]<a[i-1][0]))
		
			printf("%d %d\n",i,0);
		for(j=1;j<n-1;++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]))
			
				printf("%d %d\n",i,j);
		if(!(a[i][n-1]<a[i][n-2]||a[i][n-1]<a[i+1][n-1]||a[i][n-1]<a[i-1][n-1]))
		
			printf("%d %d\n",i,n-1);
	}
	if(!(a[m-1][0]<a[m-1][1]||a[m-1][0]<a[m-2][0]))
	
		printf("%d %d\n",m-1,0);
	for(i=1;i<n-1;++i)
		if(!(a[m-1][i]<a[m-1][i+1]||a[m-1][i]<a[m-1][i-1]||a[m-1][i]<a[m-2][i]))
		
			printf("%d %d\n",m-1,i);
	if(!(a[m-1][n-1]<a[m-1][n-2]||a[m-1][n-1]<a[m-2][n-1]))
	
		printf("%d %d\n",m-1,n-1);
}
int main()
{
	int i,j,m,n,a[22][22],k=0,h[410],g[410],s,t,p;
	cin>>m>>n;
	for(i=0;i<m;i++)
	{a[i][0]=0;
	a[i][n+1]=0;}
	for(j=1;j<=n;j++)
	{a[0][j]=0;
	 a[m+1][j]=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-1][j]
	           &&a[i][j]>=a[i+1][j]
	           &&a[i][j]>=a[i][j-1]
	           &&a[i][j]>=a[i][j+1])
	           {
           		h[k]=i-1;g[k]=j-1;
           		k=k+1;
           		} 
                s=k;
                for(k=0;k<s;k++)
                   for(i=k+1;i<s;i++)
                   if(h[k]>h[i])
                       {t=h[k];h[k]=h[i];h[i]=t;
				        p=g[k];g[k]=g[i];g[i]=p;}
				   if(h[k]==h[i])
				       {
   					     if(g[k]>g[i])
   					     {t=g[k];g[k]=g[i];g[i]=t;}
   					     }
		     for(k=0;k<s;k++)
		     cout<<h[k]<<" "<<g[k]<<endl;
	cin.get();
	return 0;
}
int main()
{
	int n , m , a[22][22];
	cin>>m>>n;
	for (int i=0;i<22;i++)
	{//??????????
	   for (int j=0;j<22;j++)
		  a[i][j]=0;
	}
	for (int i=1;i<=m;i++)
	{//??????
	   for (int j=1;j<=n;j++)
		   cin>>a[i][j];
	   cout<<endl;
	}
	for (int i=1;i<=m;i++)
	{
	   for (int j=1;j<=n;j++)
	   {//????????
	      if (a[i][j+1]-a[i][j]<=0 && 
			  a[i][j-1]-a[i][j]<=0 && 
			  a[i+1][j]-a[i][j]<=0 && 
			  a[i-1][j]-a[i][j]<=0)
			  cout<<i-1<<" "<<j-1<<endl;
	   }
	}
	return 0;
}
int main(){
int m,n,i,j,a,b,c,d,p,q,x=0;
    int sz[20][20];
    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++){
        a=i+1;
        b=i-1;
        c=j+1;
        d=j-1;
        p=m-1;
        q=n-1;
         if(i==0&&j==0){
           if(sz[i][j]>=sz[0][1]&&sz[i][j]>=sz[1][0]){
              printf("%d %d\n",i,j);
          }
        }else if(i==0&&j==q){
           if(sz[i][j]>=sz[0][d]&&sz[i][j]>=sz[1][j]){
              printf("%d %d\n",i,j);
          }
        }else if(i==p&&j==0){
           if(sz[i][j]>=sz[i][1]&&sz[i][j]>=sz[b][0]){
              printf("%d %d\n",i,j);
          }
        }else if(i==p&&j==q){
           if(sz[i][j]>=sz[i][d]&&sz[i][j]>=sz[b][j]){
              printf("%d %d\n",i,j);
          }
        }else if(i==0&&j>0&&j<q){
           if(sz[i][j]>=sz[i][c]&&sz[i][j]>=sz[i][d]&&sz[i][j]>=sz[1][j]){
              printf("%d %d\n",i,j);
          }
        }else if(i==p&&j>0&&j<q){
          if(sz[i][j]>=sz[i][c]&&sz[i][j]>=sz[i][d]&&sz[i][j]>=sz[b][j]){
              printf("%d %d\n",i,j);
          }
        }else if(j==0&&i>0&&i<p){
           if(sz[i][j]>=sz[a][j]&&sz[i][j]>=sz[b][j]&&sz[i][j]>=sz[i][1]){
              printf("%d %d\n",i,j);
          }
        }else if(j==q&&i>0&&i<p){
           if(sz[i][j]>=sz[a][j]&&sz[i][j]>=sz[b][j]&&sz[i][j]>=sz[i][d]){
              printf("%d %d\n",i,j);
          }
        }else{
          if(sz[i][j]>=sz[i][c]&&sz[i][j]>=sz[i][d]&&sz[i][j]>=sz[a][j]&&sz[i][j]>=sz[b][j]){
            printf("%d %d\n",i,j);
          }
        }

      }
    }
return 0;
}
int main(int argc, char* argv[])
{
  static int a[30][30],b[400][2];
  int i,j,k=0,m,n;
  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][j-1]&&a[i][j]>=a[i][j+1]&&a[i][j]>=a[i-1][j]&&a[i][j]>=a[i+1][j])
        {b[k][0]=i-1;b[k][1]=j-1;k++;}
     }
  }
  for(i=0;i<k;i++)
  {
     printf("%d %d\n",b[i][0],b[i][1]);
  }
	return 0;
}
int a[22][22],m,n;
int panduan(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;
    return 0;
}
int main()
{
	int i,j;
	cin>>m>>n;
	for(i=0;i<22;i++)
		for(j=0;j<22;j++)
			a[i][j]=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(panduan(i,j)!=0)
			  {
				  cout<<i-1<<" "<<j-1<<endl;
			  }
			}
   return 0;
}
void sr(int a[20][20]);
int sd(int i,int j,int a[20][20]);
int n,m;
int main()
{
	int a[20][20];
	int i,j;
	scanf("%d%d",&m,&n);
	sr(a);
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			if(sd(i,j,a)==0)
				printf("%d %d\n",i,j);
		}
	}
	return 0;
}
void sr(int a[20][20])
{
	int i,j;
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
}
int sd(int i,int j,int a[20][20])
{
	int s=0;
	if(i==0)
	{
		if(j==0)
		{
		if(a[i][j]<a[0][1]||a[i][j]<a[1][0])
			s=1;
		}
		else if(j==n-1)
		{
			if(a[i][j]<a[0][n-2]||a[i][j]<a[1][n-1])
				s=1;
		}
		else if(a[i][j]<a[i][j-1]||a[i][j]<a[i][j+1]||a[i][j]<a[1][j])
			s=1;
	}
	else if(i==m-1)
	{
		if(j==0)
		{
			if(a[i][j]<a[i-1][j]||a[i][j]<a[i][j+1])
				s=1;
		}
		else if(j==n-1)
		{
			if(a[i][j]<a[i][j-1]||a[i][j]<a[i-1][j])
				s=1;
		}
		else if(a[i][j]<a[i][j-1]||a[i][j]<a[i][j+1]||a[i][j]<a[i-1][j])
			s=1;
	}
	else
	{
		if(j==0)
		{
			if(a[i][j]<a[i-1][j]||a[i][j]<a[i+1][j]||a[i][j]<a[i][j+1])
				s=1;
		}
		else if(j==n-1)
		{
			if(a[i][j]<a[i][j-1]||a[i][j]<a[i-1][j]||a[i][j]<a[i+1][j])
				s=1;
		}
		else 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])
			s=1;
	}
	return s;
}
int max(int a[22][22],int x,int y){
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]))return(1);
else return(0);}

void main(){
int i,j,m,n,a[22][22]={0,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(max(a,i,j))printf("%d %d\n",i-1,j-1);}
// xunzhaoshanding.cpp : Defines the entry point for the console application.
//



int main()
{
	int m = 0;
	int n = 0;
	int high[21][21] = {0};
	int i = 0;
	int t = 0;

	cin >> m;
	cin >> n;

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

	for( i = 1;i <= m;i++ )
		for( t = 1;t <= n;t++ )
		{
			if( high[i][t] >= high[i - 1][t] && high[i][t] >= high[i + 1][t] && high[i][t] >= high[i][t + 1] && high[i][t] >= high[i][t - 1] )
				cout << i - 1 << " "  << t - 1 << endl;
		}

	cin >> i;

	return 0;
}
int main() {
	int m, n, k = 0;
	int a[30][30] = { 0 };
	int b[410][2] = { 0 };
	cin >> m >> n;
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 1; i <= m; i++) {
		for (int 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]) {
				b[k][0] = i;
				b[k][1] = j;
				k++;
			}
		}
	}
	for (int i = 0; i < k; i++)
		cout << b[i][0] - 1 << ' ' << b[i][1] - 1 << endl;
	return 0;
}
int main(){
int N=1000;
int m,n;
scanf("%d %d\n",&m,&n);
int sz[m+2][n+2];
for(int i=1;i<=m+2;i++){
for(int t=1;t<=n+2;t++){sz[i-1][t-1]=0;}
}

for(int i=1;i<=m;i++){
for(int t=1;t<=n;t++){scanf("%d",&sz[i][t]);}
}

int a[N][2];
int x=0;

for(int i=1;i<=m;i++){
for(int t=1;t<=n;t++){
if(sz[i][t]>=sz[i-1][t]&&sz[i][t]>=sz[i][t-1]&&sz[i][t]>=sz[i+1][t]&&sz[i][t]>=sz[i][t+1]){a[x][0]=i-1;a[x][1]=t-1;x++;}
}
}

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

return 0;

}
int main( ){
    int i,k,m,n,q=0;
    int sz[22][22],mm[100],nn[100];
    scanf("%d %d",&m,&n);
    for(i=1;i<m+1;i++){
        for(k=1;k<n+1;k++){
            scanf("%d",&sz[i][k]);
        }
    }
    for(i=0;i<m+2;i++){
        for(k=0;k<n+2;k++){
    if(i==0||i==m+1||k==0||k==n+1){
        sz[i][k]=0;
    }
        }
    }
      for(i=1;i<m+1;i++){
        for(k=1;k<n+1;k++){
                if(sz[i][k]>=sz[i][k+1]&&sz[i][k]>=sz[i][k-1]&&sz[i][k]>=sz[i+1][k]&&sz[i][k]>=sz[i-1][k]){ 
                mm[q]=i-1;
                nn[q]=k-1;
                q++;
                }
            }
      }
    for(i=0;i<q;i++){
    printf("%d %d\n",mm[i],nn[i]);
    }
    return 0;
}
int main()
{
    int m,n,s[max+2][max+2],i,j;
	scanf("%d %d",&m,&n);
	for(i=1;i<=m;i++){
		for(j=1;j<=n;j++){
			scanf("%d",&s[i][j]);
		}
	}
	for(i=0;i<=m+1;i++){
		s[i][0]=s[i][n+1]=0;
	}
	for(j=0;j<=n+1;j++){
		s[0][j]=s[m+1][j]=0;
	}
for(i=1;i<=m;i++){
		for(j=1;j<=n;j++){
			if(s[i-1][j]<=s[i][j]&&s[i+1][j]<=s[i][j]&&s[i][j+1]<=s[i][j]&&s[i][j-1]<=s[i][j]){
				printf("%d %d\n",i-1,j-1);
			}
		}
	}
	return 0;
}
main()
{
      int m,n,i,j;
      int a[1000][1000];
      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(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,j);
                      }
      }
}
int main()
{
	int m,n,i,j;
	scanf("%d %d",&m,&n);
	int h[22][22],a[22][22];
	for(i=1;i<=m;i++)
	{
		for(j=1;j<=n;j++)
			scanf("%d",&h[i][j]);
	}
	for(i=0;i<=m+1;i++)
	{
		h[i][0]=0;
		h[i][n+1]=0;
	}
	for(j=0;j<=n+1;j++)
	{
		h[0][j]=0;
		h[m+1][j]=0;
	}
	
	
	for(i=1;i<=m;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(h[i][j]>=h[i-1][j]&&h[i][j]>=h[i+1][j]&&h[i][j]>=h[i][j-1]&&h[i][j]>=h[i][j+1])
				printf("%d %d\n",i-1,j-1);
		}

	}
	return 0;


}
int main(){
	int sz[20][20];
	int m,n;
	scanf("%d%d",&m,&n);
	for(int j=0;j<m;j++){
		for(int k=0;k<n;k++){
			scanf("%d",&sz[j][k]);
		}
	}
	for(int i=0;i<m;i++){
		for(int t=0;t<n;t++){
			if((i!=0)&&(i!=m-1)&&(t!=0)&&(t!=n-1)){
				if((sz[i][t]>=sz[i-1][t])&&(sz[i][t]>=sz[i+1][t])&&(sz[i][t]>=sz[i][t-1])&&(sz[i][t]>=sz[i][t+1])){
					printf("%d %d\n",i,t);
				}
			}
			else if((i==0)&&(t==0)){
				if((sz[0][0]>=sz[0][1])&&(sz[0][0]>=sz[1][0])){
					printf("%d %d\n",i,t);
				}
			}
			else if((i==0)&&(t==n-1)){
				if((sz[0][n-1]>=sz[0][n-2])&&(sz[0][n-1]>=sz[1][n-1])){
					printf("%d %d\n",i,t);
				}
			}
			else if((i==m-1)&&(t==0)){
				if((sz[m-1][0]>=sz[m-2][0])&&(sz[m-1][0]>=sz[m-1][1])){
					printf("%d %d\n",i,t);
				}
			}
			else if((i==m-1)&&(t==n-1)){
				if((sz[m-1][n-1]>=sz[m-1][n-2])&&(sz[m-1][n-1]>=sz[m-2][n-1])){
					printf("%d %d\n",i,t);
				}
			}
			else if(i==0){
				if((sz[i][t]>=sz[i+1][t])&&(sz[i][t]>=sz[i][t-1])&&(sz[i][t]>=sz[i][t+1])){
					printf("%d %d\n",i,t);
				}
			}
			else if(i==m-1){
				if((sz[i][t]>=sz[i-1][t])&&(sz[i][t]>=sz[i][t-1])&&(sz[i][t]>=sz[i][t+1])){
					printf("%d %d\n",i,t);
				}
			}
			else if(t==0){
				if((sz[i][t]>=sz[i-1][t])&&(sz[i][t]>=sz[i+1][t])&&(sz[i][t]>=sz[i][t+1])){
					printf("%d %d\n",i,t);
				}
			}
			else if(t==n-1){
				if((sz[i][t]>=sz[i-1][t])&&(sz[i][t]>=sz[i+1][t])&&(sz[i][t]>=sz[i][t-1])){
					printf("%d %d\n",i,t);
				}
			}
		}
	}
	return 0;
}
int main ()
{
	int m, n, a[21][21] = { 0} , i ,  j , k = 0 , dis[2][21] = { 0 };
	cin >> m >> n;
	for( i = 0 ; i < m; i++)
	{
		for( j = 0; j < n; j++)
		{
			cin >> a[i][j];
		}
	}
	for( i = 0 ; i < m; i++)
	{
		for( j = 0 ; j < n; j++)
		{
			if( i == 0 && j != 0 && j!= n-1)
			{
				if (( a[i][j] >= a[i][j-1]) &&( a[i][j] >= a[i][j+1]) && (a[i][j] >= a[i+1][j]))
				{
				cout << i <<" " << j << endl;
				}
			}
			if( i == m-1 && j != 0 && j!= n-1)
			{
				if ( a[i][j] >= a[i][j-1] && a[i][j] >= a[ i][j+1] && a[i][j] >= a[i-1][j])
				{
                   cout << i <<" " << j << endl;
				}
			}
			if(  j == 0 && i != 0 && i != m-1)
			{
				if( a[i][j]>= a[i-1][j] && a[i][j] >= a[i][j+1] && a[i][j]>=a[i+1][j])
				{cout << i <<" " << j << endl;
				}
			}
			
			if(  j == n-1 && i != 0 && i != m-1)
			{
				if( a[i][j]>= a[i-1][j] && a[i][j] >= a[i][j-1] && a[i][j] >=a[ i+1][j])
				{
				cout << i <<" " << j << endl;
				}
			}
			if( i == 0 && j == 0)
			{
				if( a[i][j] >= a[i][j+1] && a[i][j] >= a[i+1][j])
				{
				cout << i <<" " << j << endl;
				}
			}
           if( i == 0 && j == n-1)
			{
				if( a[ i ] [ j ]  >= a[i][j-1] && a[i][j] >= a[ i+1][ j])
				{cout << i <<" " << j << endl;
				}
			}
			if( i == m -1 && j == 0)
			{
				if( a [ i ] [ j] >= a[ i-1][j] && a[i][j] >= a[i][j+1])
				{cout << i <<" " << j << endl;
				}
			}
			if( i == m -1 && j == n -1)
			{
				if( a[i][j] >= a[i-1][j] && a[i][j] >= a[i][j-1])
				{cout << i <<" " << j << endl;
				}
			}
			if( i != 0 && i != m-1 && j != 0 && j != n-1)
			{
				if( (a[i][j] >= a[i-1][j])&&(a[i][j] >= a[i][j+1])&&(a[i][j]>=a[i][j-1])&&(a[i][j] >= a[i+1][j]))
				{
				cout << i <<" " << j << endl;
				}
			}
		}
	}

	return 0;
}
int main()
{
	int n,m,a[300][300]={0},i,j,b=0,k,l;
	
	scanf("%d %d",&m,&n);
	m+=2;
	n+=2;

	for(i=1;i<(m-1);i++)
	{
		for(j=1;j<(n-1);j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	
	for(k=1;k<(m-1);k++)
	{
		for(l=1;l<(n-1);l++)
		{
			if(a[k][l]>=a[k+1][l]&&a[k][l]>=a[k][l+1]&&a[k][l]>=a[k-1][l]&&a[k][l]>=a[k][l-1])
			{
				printf("%d %d\n",k-1,l-1);
			}
		}
	}
	
	return 0;
}
int main()
{
    int m,n,i,j,judge;
    int a[20][20];
    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++)
        {
            judge=1;
            if(i>0)
                judge=judge*(a[i][j]>=a[i-1][j]);
            if(j>0)
                judge=judge*(a[i][j]>=a[i][j-1]);
            if(i<m-1)
                judge=judge*(a[i][j]>=a[i+1][j]);
            if(j<n-1)
                judge=judge*(a[i][j]>=a[i][j+1]);
            if(judge==1)
                printf("%d %d\n",i,j);
        }

    return 0;
}
int main()
{
	int i,j,k,t,m,n;
	int a[22][22]={0},b[20][20]={0};
	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(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 m,n,i,j,k; 
  int up=0,down=0,left=0,right=0;    
  int a[22][22]={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++)
      {
          up=a[i][j]-a[i-1][j];
          down=a[i][j]-a[i+1][j];
          left=a[i][j]-a[i][j-1];
          right=a[i][j]-a[i][j+1];
       
           if(up>=0 && down>=0 && left>=0 && right>=0)
           {printf("%d %d\n",i-1,j-1);}
      }                                
  }      
}
/*
 * 11.6.cpp
 *
 *  Created on: 2011-11-4
 *      Author: 11095
 */

int main()
{
	int m,n;
	cin>>m>>n;
	int mout[m][n],i,j;
	for(i=0;i<m;i++){                //????m*n???
		for(j=0;j<n;j++){
			cin>>mout[i][j];
		}
	}

	int vmt[m+2][n+2];              //?m*n?????????
	for (j=0;j<n+2;j++){
		vmt[0][j]=0;
		vmt[m+1][j]=0;
	}
	for(i=0;i<m+2;i++){
		vmt[i][0]=0;
		vmt[i][n+1]=0;
	}
	for(i=1;i<m+1;i++){
		for(j=1;j<n+1;j++){
			vmt[i][j]=mout[i-1][j-1];
		}
	}

	for(i=1;i<m+1;i++){
		for(j=1;j<n+1;j++){
			if(vmt[i][j]>=vmt[i-1][j]&&vmt[i][j]>=vmt[i+1][j]&&vmt[i][j]>=vmt[i][j-1]&&vmt[i][j]>=vmt[i][j+1]){
				i--;j--;
				cout<<i<<" "<<j<<endl;
				i++;j++;
			}

		}
	}
	return 0;
}
int main(){
  int A[100][100],m,n;
  scanf("%d%d",&m,&n);
  for(int i=0;i<m+2;i++){
      for(int j=0;j<n+2;j++){
          if(i==0||j==0||i==m+1||j==n+1){A[i][j]=0;}  
          else{scanf("%d",&(A[i][j])); }
           
              }    
          }
  for(int i=1;i<m+1;i++){
      for(int j=1;j<n+1;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 ",i-1);
              printf("%d\n",j-1);                                                                            
                 }
                }
          }
          
return 0;
}
int i,j,a[22][22]={0};
int max(int i,int j);
void main()
{
	int m,n;
	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(max(i,j)==1)
				printf("%d %d\n",i-1,j-1);
}
int max(int i,int 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])
		return 1;
	else
		return 0;
}
int main(){
int m,n,i,k,t;
int sz[20][20];
scanf("%d %d",&m,&n);
for(i=0;i<m;i++){
	for(k=0;k<n;k++){
		scanf("%d",&sz[i][k]);
	}
}
for(i=0;i<m;i++){
	for(k=0;k<n;k++){
		if(i==0){
			if(k==0&&sz[0][0]>=sz[0][1]&&sz[0][0]>=sz[1][0]){
				printf("0 0\n");
			}else if(k==n-1&&sz[0][n-1]>=sz[1][n-1]&&sz[0][n-2]<=sz[0][n-1]){
				printf("0 %d\n",n-1);
			}else if(sz[0][k]>=sz[0][k-1]&&sz[0][k]>=sz[0][k+1]&&sz[0][k]>=sz[1][k]){
				printf("0 %d\n",k);
			}
		}else if(i==m-1){
			if(k==0&&sz[m-1][0]>=sz[m-1][1]&&sz[m-1][0]>=sz[m-2][0]){
				printf("%d 0\n",m-1);
			}else if(k==n-1&&sz[m-1][n-1]>=sz[m-2][n-1]&&sz[m-1][n-1]>=sz[m-1][n-2]){
				printf("%d %d\n",m-1,n-1);
			}else if(sz[m-1][k]>=sz[m-1][k-1]&&sz[m-1][k]>=sz[m-1][k+1]&&sz[m-1][k]>=sz[m-2][k]){
				printf("%d %d\n",m-1,k);
			}
		}else if(k==0){
			if(sz[i][0]>=sz[i][1]&&sz[i][0]>=sz[i-1][0]&&sz[i][0]>=sz[i+1][0]){
				printf("%d 0\n",i);
			}
		}else if(k==n-1){
			if(sz[i][n-1]>=sz[i][n-2]&&sz[i][n-1]>=sz[i-1][n-1]&&sz[i][n-1]>=sz[i+1][n-1]){
				printf("%d %d\n",i,n-1);
			}
		}else{
			if(sz[i][k]>=sz[i][k-1]&&sz[i][k]>=sz[i][k+1]){
				if(sz[i][k]>=sz[i-1][k]&&sz[i][k]>=sz[i+1][k]){
					printf("%d %d\n",i,k);
				}
			}
		}
	}
}
return 0;
}
int main()
{
	int a[20][20], i, j, max, m , n, flag = 1;
	cin >> m >> n;
	for(i = 0; i < m; i++)
		for(j = 0; j < n; j++)
			cin >> a[i][j];
	for(i = 0; i < m; i++)
	{
		for(j = 0; j < n; j++)
		{
			flag = 1;
			if(j - 1 >= 0)
				if(a[i][j] < a[i][j - 1])
					flag = 0;
			if(i - 1 >= 0)
				if(a[i][j] < a[i - 1][j])
					flag = 0;
			if(j + 1 < n)
				if(a[i][j] < a[i][j + 1])
					flag = 0;
			if(i + 1 < m)
				if(a[i][j] < a[i + 1][j])
					flag = 0;
			if(flag == 1)
				cout << i << ' ' << j << endl;
		}
	}
	return 0;
}
int main()
{
	int m, n, i, j, a[22][22] = {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][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,i,j;
    scanf("%d%d",&m,&n);
    int a[m+2][n+2];
    for(i=1;i<m+1;i++){
      for(j=1;j<n+1;j++){
       scanf("%d",&a[i][j]);
      }
    }
    for(j=0;j<n+2;j++){
       a[0][j]=0;
     }
    for(j=0;j<n+2;j++){
       a[m+1][j]=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+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]){
     printf("%d %d\n",i-1,j-1);
     }
    }
   }
   return 0;
}
int main()
{
	int m,n,i,j,hill[20][20],ave;
	cin>>m>>n;
	for(i=0;i<m;i++)
		for(j=0;j<n;j++)
			cin>>hill[i][j];
	for(i=0;i<m;i++)
		for(j=0;j<n;j++)
		{
			if(i==0||hill[i][j]>=hill[i-1][j])
				if(i==m-1||hill[i][j]>=hill[i+1][j])
					if(j==0||hill[i][j]>=hill[i][j-1])
						if(j==n-1||hill[i][j]>=hill[i][j+1])
							cout<<i<<" "<<j<<endl;
		}
		return 0;


}
int main(){
    int m, n;
    scanf("%d%d", &m, &n);
    int height[m+2][n+2];
    int i1, i2;
    for(i2=0; i2<n+2; i2++){
        height[0][i2]=-1;
        height[m+1][i2]=-1;
    }
    for(i1=0; i1<m+2; i1++){
        height[i1][0]=-1;
        height[i1][n+1]=-1;
    }
    for(i1=1; i1<m+1; i1++){
        for(i2=1; i2<n+1; i2++){
            scanf("%d", &height[i1][i2]);
        }
    }

    for(i1=1; i1<m+1; i1++){
        for(i2=1; i2<n+1; i2++){
            if(height[i1][i2]>=height[i1-1][i2] && height[i1][i2]>=height[i1+1][i2] && height[i1][i2]>=height[i1][i2-1] && height[i1][i2]>=height[i1][i2+1]) {
                printf("%d %d\n", i1-1, i2-1);
            }
            else continue;
        }
    }
    return 0;
}