semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
    int m,n;
    scanf("%d%d",&m,&n);
    int sz[m][n];
    int zs[m][n];
    for(int i=0;i<m;i++){
        for(int x=0;x<n;x++){
            scanf("%d",&sz[i][x]);
            zs[i][x]=1;
        }
    }
    for(int i=0;i<m;i++){
        if(i==0){
            for(int x=0;x<n;x++){
                if(sz[i][x]>=sz[i+1][x]){
                    zs[i][x]=zs[i][x]*1;
                }else{
                     zs[i][x]=zs[i][x]*0;
                }
            }
        }
        if(i>0&&i<m-1){
            for(int x=0;x<n;x++){
                if(sz[i][x]>=sz[i+1][x]){
                    zs[i][x]=zs[i][x]*1;
                }else{
                     zs[i][x]=zs[i][x]*0;
                }
                if(sz[i][x]>=sz[i-1][x]){
                    zs[i][x]=zs[i][x]*1;
                }else{
                     zs[i][x]=zs[i][x]*0;
                }
            }
        }
        if(i==m-1){
            for(int x=0;x<n;x++){
                if(sz[i][x]>=sz[i-1][x]){
                    zs[i][x]=zs[i][x]*1;
                }else{
                     zs[i][x]=zs[i][x]*0;
                }
            }
        }
    }
    for(int x=0;x<n;x++){
        if(x==0){
            for(int i=0;i<m;i++){
                if(sz[i][x]>=sz[i][x+1]){
                    zs[i][x]=zs[i][x]*1;
                }else{
                     zs[i][x]=zs[i][x]*0;
                }
            }
        }
        if(x>0&&x<n-1){
            for(int i=0;i<m;i++){
                if(sz[i][x]>=sz[i][x+1]){
                    zs[i][x]=zs[i][x]*1;
                }else{
                     zs[i][x]=zs[i][x]*0;
                }
                if(sz[i][x]>=sz[i][x-1]){
                    zs[i][x]=zs[i][x]*1;
                }else{
                     zs[i][x]=zs[i][x]*0;
                }
            }
        }
        if(x==n-1){
            for(int i=0;i<m;i++){
                if(sz[i][x]>=sz[i][x-1]){
                    zs[i][x]=zs[i][x]*1;
                }else{
                     zs[i][x]=zs[i][x]*0;
                }
            }
        }
    }
    for(int i=0;i<m;i++){
        for(int x=0;x<n;x++){
            if(zs[i][x]==1){
                printf("%d %d\n",i,x);
            }
        }
    }
return 0;
}
int main()
{
	int n,m,i,j;
	cin>>n>>m;
	int a[n+2][m+2];
	for(i=0;i<n+2;i++)
			for(j=0;j<m+2;j++)a[i][j]=0;
	for(i=1;i<n+1;i++)
		for(j=1;j<m+1;j++)
		{
			cin>>a[i][j];
		}
	for(i=1;i<n+1;i++)
		for(j=1;j<m+1;j++)
		{
         if((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]<=a[i][j])	)
         {
        	 cout<<i-1<<" "<<j-1<<endl;
         }
		}
	return 0;
}
int main()
{
	int n,m,i,j,a[100][100];
	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){
				if(j==0){
					if(a[i][j]>=a[i+1][j]&&a[i][j]>=a[i][j+1]){
						printf("%d %d\n",i,j);continue;
					}
				}
				if(j==n-1){
					if(a[i][j]>=a[i+1][j]&&a[i][j]>=a[i][j-1]){
						printf("%d %d\n",i,j);continue;
					}
				}
				if(j!=0&&j!=n-1&&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);continue;
				}
			}
			if(i==m-1){
				if(j==0){
					if(a[i][j]>=a[i-1][j]&&a[i][j]>=a[i][j+1]){
						printf("%d %d\n",i,j);continue;
					}
				}
				if(j==n-1){
					if(a[i][j]>=a[i-1][j]&&a[i][j]>=a[i][j-1]){
						printf("%d %d\n",i,j);continue;
					}
				}
				if(j!=0&&j!=n-1&&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);continue;
				}
			}
			if(i!=0&&i!=m-1&&j==0){
				if(a[i][j]>=a[i-1][j]&&a[i][j]>=a[i+1][j]&&a[i][j]>=a[i][j+1]){
					printf("%d %d\n",i,j);continue;
				}
			}
			if(i!=0&&i!=m-1&&j==n-1){
				if(a[i][j]>=a[i-1][j]&&a[i][j]>=a[i+1][j]&&a[i][j]>=a[i][j-1]){
					printf("%d %d\n",i,j);continue;
				}
			}
			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);continue;
			}
		}
	}
	return 0;
}
int judge(int s[22][22],int i,int j,int m,int n);//judge???ij????????? 
int main()
{
    int m=0,n=0,i=0,j=0,s[22][22]={0};
      cin>>m>>n;
      for(i=0;i<=m-1;i++)//???? 
         for(j=0;j<=n-1;j++)
            cin>>s[i][j];
      for(i=0;i<=m-1;i++)
        for(j=0;j<=n-1;j++)
            {
               if(judge(s,i,j,m,n))      
               cout<<i<<" "<<j<<endl;         
            }
return 0;    
}
int judge(int s[22][22],int i,int j,int m,int n)//judge???ij????????? 
{
        int ji=0;
        if(((i-1>=0)&&(s[i][j]>=s[i-1][j]))||(i==0))
        ji++;
        if(((i+1<=m-1)&&(s[i][j]>=s[i+1][j]))||(i==m-1))
        ji++;
        if(((j-1>=0)&&(s[i][j]>=s[i][j-1]))||(j==0))
        ji++;
        if(((j+1<=n-1)&&(s[i][j]>=s[i][j+1]))||(j==n-1))
        ji++;
        if(ji==4)
        return 1;
        else
        return 0;
}
int m,n,a[20][20];
void gaocheng(int i,int j){
	if(i==0&&j>0&&j<n) {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;
	}
	else if(i==0&&j>0&&j<n) {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;}
	else if(j==0&&i>0&&i<m) {if(a[i][j]>=a[i][j+1]&&a[i][j]>=a[i-1][j]
	&&a[i][j]>=a[i+1][j])  cout<<i<<" "<<j<<endl;
	}
	else if(j==n&&i>0&&i<m) {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;
	}
	else if(j==0&&i==0) {if(a[i][j]>=a[i+1][j]&&a[i][j]>=a[i][j+1]) cout<<i<<" "<<j<<endl;}
	else if(i==0&&j==n) {if(a[i][j]>=a[i+1][j]&&a[i][j]>=a[i][j-1]) cout<<i<<" "<<j<<endl;}
	else if(i==m&&j==0) {if(a[i][j]>=a[i-1][j]&&a[i][j]>=a[i][j+1]) cout<<i<<" "<<j<<endl;}
	else if(i==m&&j==n) {if(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][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<<" "<<j<<endl;}
}
int main(){
	int i,j;
	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++)
			gaocheng(i,j);
	
}
int main()
{
    int n, m, a[50][50] = {{0}} ,i, j, h[500], l[500], cc = 0;
    cin >> n >> m;   //???
    for (i = 1; i <= n; i++)
    {
        for (j = 1; j <= m; j++)
        {
            cin >> a[i][j];
        }
    }
    for (i = 1; i <= n; i++)
    {
        for (j = 1; j <= m; 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])
            {
                h[cc] = i;
                l[cc] = j;
                cc++;
            }
        }
    }
    int to = cc;
    for (i = 0; i < to; i++)
    {
        for (j = 0; j < to - 1; j++)
        {
            if (h[j] > h[j+1])
            {
                int temp;
                temp = h[j+1];
                h[j+1] = h[j];
                h[j] = temp;
                temp = l[j+1];
                l[j+1] = l[j];
                l[j] = temp;
                continue;
            }
            if (h[j] == h[j+1] && l[j] > l[j+1])
            {
                int temp;
                temp = h[j+1];
                h[j+1] = h[j];
                h[j] = temp;
                temp = l[j+1];
                l[j+1] = l[j];
                l[j] = temp;
            }
        }
    }
    for (i = 0; i < to; i++)
    {
        cout << h[i] - 1 << " " << l[i] - 1 << endl;
    }
    return 0;
}
int comp(int center,int up,int left,int down,int right)
{
	if((center>=up) && (center>=left) && (center>=down) && (center>=right))
		return 1;
	else 
		return 0;
}
int main()
{
	int a[22][22],m,n,i,j,k,r;
	scanf("%d %d",&m,&n);
	for(i=0;i<=m+1;i++)
	{
		a[i][0]=-1;
		a[i][n+1]=-1;
	}
	for(i=0;i<=n+1;i++)
	{
		a[0][i]=-1;
		a[m+1][i]=-1;
	}
	for(i=1;i<m+1;i++)
	{
		for(r=1;r<n+1;r++)
			scanf("%d",&a[i][r]);
	}
	for(j=1;j<m+1;j++)				//????????
	{
		for(k=1;k<n+1;k++)
		{
			if(comp(a[j][k],a[j-1][k],a[j][k-1],a[j+1][k],a[j][k+1]))
				printf("%d %d\n",j-1,k-1);
		}
	}
	return 0;
}
int main (){
int m,n,i,j,a,b,c,d;
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++){
	 if (i!=0&&i!=m-1&&j!=0&&j!=n-1){
       a=sz[i-1][j]-sz[i][j];
       b=sz[i+1][j]-sz[i][j];
       c=sz[i][j-1]-sz[i][j];
       d=sz[i][j+1]-sz[i][j];
       if (a<=0&&b<=0&&c<=0&&d<=0){
             printf("%d %d\n",i,j); 
			 continue;                  
           }
       }       
     if (i==0){
			if(j==0){
			  b=sz[i+1][j]-sz[i][j];
			  d=sz[i][j+1]-sz[i][j];
			  if (b<=0&&d<=0){
                  printf("%d %d\n",i,j); 
			 continue;                              
               }
			}
			if(j==n-1){
		        	b=sz[i+1][j]-sz[i][j];
                    c=sz[i][j-1]-sz[i][j];
					if (b<=0&&c<=0){
                      printf("%d %d\n",i,j); 
			 continue;                              
                    }
		    	}
			else {
				b=sz[i+1][j]-sz[i][j];
				c=sz[i][j-1]-sz[i][j];
			    d=sz[i][j+1]-sz[i][j];
			     if (b<=0&&c<=0&&d<=0){
                 printf("%d %d\n",i,j);  
			 continue;                             
                 }
				}
		}
     if (i==m-1){
			if(j==0){
				 a=sz[i-1][j]-sz[i][j];
			     d=sz[i][j+1]-sz[i][j];
			  if (a<=0&&d<=0){
                  printf("%d %d\n",i,j);  
			 continue;                             
                 }
			}
			if(j==n-1){
		        	a=sz[i-1][j]-sz[i][j];
                    c=sz[i][j-1]-sz[i][j];
					if (a<=0&&c<=0){
                      printf("%d %d\n",i,j);  
			 continue;                             
                    }
		    	}
			else {
				a=sz[i-1][j]-sz[i][j];
				c=sz[i][j-1]-sz[i][j];
			    d=sz[i][j+1]-sz[i][j];
			     if (a<=0&&c<=0&&d<=0){
                 printf("%d %d\n",i,j);  
			 continue;                             
                 }
				}
		}
	 if (j==0&&i!=0&&i!=m-1){
			a=sz[i-1][j]-sz[i][j];
            b=sz[i+1][j]-sz[i][j];
	        d=sz[i][j+1]-sz[i][j];
			  if (a<=0&&b<=0&&d<=0){
                 printf("%d %d\n",i,j);  
			 continue;                             
                 }
      }
    if (j==n-1&&i!=0&&i!=m-1){
			a=sz[i-1][j]-sz[i][j];
            b=sz[i+1][j]-sz[i][j];
            c=sz[i][j-1]-sz[i][j];
			  if (a<=0&&b<=0&&c<=0){
                 printf("%d %d\n",i,j);  
			 continue;                             
                 }
      }
      }
	}
 return 0;
}
int main(){
    int m,n,i,j;
	scanf("%d%d",&m,&n);
	int h[20][20];
	for(i=0;i<m;i++)
		for(j=0;j<n;j++)
			scanf("%d",&h[i][j]);
	int x[400][2],N=0;
	for(i=0;i<m;i++)
		for(j=0;j<n;j++)
			if(
				(i==0||h[i][j]>=h[i-1][j])
				&&(i==m-1||h[i][j]>=h[i+1][j])
				&&(j==0||h[i][j]>=h[i][j-1])
				&&(j==n-1||h[i][j]>=h[i][j+1])
			){
				x[N][1]=i;
				x[N][2]=j;
				N++;
			}
	for(i=0;i<N;i++)
		printf("%d %d\n",x[i][1],x[i][2]);
	return 0;
}
void main ()
{
     int i,j,a[22][22],m,n;
     scanf("%d%d",&m,&n);
     for (j=0;j<n+2;j++)
      { a[0][j]=0;a[m+1][j]=0;}
     for (i=1;i<m+2;i++)
      { a[i][0]=0;a[i][n+1]=0;}
     for (i=1;i<m+1;i++)
         for (j=1;j<n+1;j++)
         scanf("%d",&a[i][j]);
     for (i=1;i<m+1;i++)
        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-1,j-1);
        }
        
}
int main(){
    int m,n;
    int i,j;
    scanf("%d%d",&m,&n);
    int a[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("0 %d\n",j);
        }
    if(a[0][n-1]>=a[0][n-2] && a[0][n-1]>=a[1][n-1]) printf("0 %d\n",n-1);

    for(i=1;i<m-1;i++){
        if(a[i][0]>=a[i+1][0] && a[i][0]>=a[i-1][0] && a[i][0]>=a[i][1]) printf("%d 0\n",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,j);
                }
            }
        if(a[i][n-1]>=a[i+1][n-1] && a[i][n-1]>=a[i-1][n-1] && a[i][n-1]>=a[i][n-2]) 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 0\n",m-1);
    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);
    return 0;
}
int main(){
    int m,n,i,j;
    scanf("%d%d",&m,&n);
    int sz[m+2][n+2];
    for(i=1;i<m+1;i++){
        for(j=1;j<n+1;j++){
            scanf("%d",&sz[i][j]);
        }
    }
    for(j=0;j<n+2;j++){
    sz[0][j]=0;
    sz[m+1][j]=0;
    }
    for(i=0;i<m+2;i++){
        sz[i][0]=0;
        sz[i][n+1]=0;
    }
    for(i=1;i<m+1;i++){
        for(j=1;j<n+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])
        printf("%d %d\n",i-1,j-1);
        }
    }
    return 0;
}
int main()
{
	int m,n,mount[100][100]={0};
	cin>>m>>n;
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j<=n;j++)
			cin>>mount[i][j];
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(mount[i][j]>=mount[i][j+1]&&mount[i][j]>=mount[i][j-1]&&mount[i][j]>=mount[i+1][j]&&mount[i][j]>=mount[i-1][j])
				cout<<i-1<<" "<<j-1<<endl;
		}
	}
	return 0;
}
/*????
 * exercise7.cpp
 *
 *  Created on: 2011-12-30
 *      Author: WJ
 */

int main() {
	int a[20][20], b[400][2], i, j, m, n, p = 0; //?a?????????b??????????
	cin >> m >> n; //p???????
	for (i = 0; i < m; i++)
		for (j = 0; j < n; j++)
			cin >> a[i][j];
	if ((a[0][0] >= a[0][1]) && (a[0][0] >= a[1][0])) { //?????????????????
		b[p][0] = 0;
		b[p][1] = 0;
		p++;
	}
	if ((a[0][n - 1] >= a[1][n - 1]) && (a[0][n - 1] >= a[0][n - 2])) {
		b[p][0] = 0;
		b[p][1] = n - 1;
		p++;
	}
	if ((a[m - 1][0] >= a[m - 1][1]) && (a[m - 1][0] >= a[m - 2][0])) {
		b[p][0] = m - 1;
		b[p][1] = 0;
		p++;
	}
	if ((a[m - 1][n - 1] >= a[m - 1][n - 2]) && (a[m - 1][n - 1] >= a[m - 2][n
			- 1])) {
		b[p][0] = m - 1;
		b[p][1] = n - 1;
		p++;
	}
	for (i = 1; i < m - 1; i++) {
		if ((a[i][0] >= a[i - 1][0]) && (a[i][0] >= a[i + 1][0]) && (a[i][0]
				>= a[i][1])) {
			b[p][0] = i;
			b[p][1] = 0;
			p++;
		}
	}
	for (i = 1; i < m - 1; i++) {
		if ((a[i][n - 1] >= a[i - 1][n - 1])
				&& (a[i][n - 1] >= a[i + 1][n - 1]) && (a[i][n - 1] >= a[i][n
				- 2])) {
			b[p][0] = i;
			b[p][1] = n-1;
			p++;
		}
	}
	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])) {
			b[p][0] = 0;
			b[p][1] = j;
			p++;
		}
	}
	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])) {
			b[p][0] = m - 1;
			b[p][1] = j;
			p++;
		}
	}
	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])) {
				b[p][0] = i;
				b[p][1] = j;
				p++;
			}
	int temp1, temp2, temp3; //???????
	for (i = 0; i < p - 1; i++) {
		for (j = 0; j < p - 1 - i; j++) {
			if (b[j][0] > b[j + 1][0]) {
				temp1 = b[j][0];
				b[j][0] = b[j + 1][0];
				b[j + 1][0] = temp1;
				temp2 = b[j][1];
				b[j][1] = b[j + 1][1];
				b[j + 1][1] = temp2;
			}
			if ((b[j][0] == b[j + 1][0]) && (b[j][1] > b[j + 1][1])) {
				temp3 = b[j][1];
				b[j][1] = b[j + 1][1];
				b[j + 1][1] = temp3;
			}
		}
	}
	for (i = 0; i < p; i++) {
		cout << b[i][0] << " " << b[i][1] << endl;
	}
	return 0;
}
int main()
{int m,n;
cin>>m>>n;
int i,j;
int h[22][22];
for(i=0;i<22;i++)
{for(j=0;j<22;j++)
h[i][j]=0;
                 }    
for(i=1;i<=m;i++)
{for(j=1;j<=n;j++)
cin>>h[i][j];
                 }    
for(i=1;i<=m;i++)
{for(j=1;j<=n;j++)
{if(h[i][j]>=h[i][j-1]&&h[i][j]>=h[i][j+1]&&h[i][j]>=h[i+1][j]&&h[i][j]>=h[i-1][j])
cout<<i-1<<" "<<j-1<<endl;
                  }
                 }
return 0;

    }
int main(){
    int m,n,i,j,a[100][100],b[100]={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][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);
                }           
            }
        }
   
    
    scanf("%d",&i);
    return 0;
    }
void main()
{
    int i,j,n,m,s[20][20],t=0;
    scanf("%d%d",&m,&n);
    for(i=0;i<m;i++)
    for(j=0;j<n;j++)
    scanf("%d",&s[i][j]);
    if((s[0][0]>=s[0][1])&&(s[0][0]>=s[1][0]))
    printf("%d %d\n",t,t);
    for(i=1;i<n-1;i++)
    {
    	if((s[0][i]>=s[0][i+1])&&(s[0][i]>=s[1][i])&&(s[0][i])>=s[0][i-1])
    	printf("%d %d\n",t,i);
    }
    if((s[0][n-1]>=s[0][n-2])&&(s[0][n-1]>=s[1][n-1]))
    printf("%d %d\n",t,n-1);
    for(i=1;i<m-1;i++)
    {
    	if((s[i][0]>=s[i-1][0])&&(s[i][0]>=s[i][1])&&(s[i][0]>=s[i+1][0]))
    	printf("%d %d\n",i,t);
    	for(j=1;j<n-1;j++)
    	{
    	if((s[i][j]>=s[i][j-1])&&(s[i][j]>=s[i][j+1])&&(s[i][j]>=s[i-1][j])&&(s[i][j]>=s[i+1][j]))
    	printf("%d %d\n",i,j);
    	}
    	if((s[i][n-1]>=s[i][n-2])&&(s[i][n-1]>=s[i-1][n-1])&&(s[i][n-1]>=s[i+1][n-1]))
    	printf("%d %d\n",i,n-1);
    }
    if((s[m-1][0]>=s[m-2][0])&&(s[m-1][0]>=s[m-1][1]))
    printf("%d %d\n",m-1,t);
    for(i=1;i<n-1;i++)
    {
    	if((s[m-1][i]>=s[m-1][i+1])&&(s[m-1][i]>=s[m-2][i])&&(s[m-1][i])>=s[m-1][i-1])
    	printf("%d %d\n",m-1,i);
    }
    if((s[m-1][n-1]>=s[m-1][n-2])&&(s[m-1][n-1]>=s[m-2][n-1]))
    printf("%d %d",m-1,n-1);
    
}
int main()
{
    int a[22][22],i,j,k=0,m,n,o,p,c[22],d[22];
    scanf("%d %d",&m,&n);
     for(i=0;i<m+2;i++)
    {
                    for(j=0;j<n+2;j++)
                    {
                           a[i][j]=0;
                    }
    }     
    for(i=1;i<m+1;i++)
    {
                    for(j=1;j<n+1;j++)
                    {
                             scanf("%d ",&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])
                                    {
                                                                                                                       printf("%d %d\n",i-1,j-1);
}
}
}
    return 0;
}
int main()
{
    int m,n;
    int h[22][22];
    cin>>m>>n;
    int i,j;
    for(i=0;i<=n+1;i++) h[0][i]=h[m+1][i]=0;
    for(j=1;j<=m;j++)
    { h[j][0]=h[j][n+1]=0;
    for(i=1;i<=n;i++) cin>>h[j][i];}
    
    for(j=1;j<=m;j++)
    for(i=1;i<=n;i++)
    if(h[j][i]>=h[j-1][i]&&h[j][i]>=h[j+1][i]&&h[j][i]>=h[j][i+1]&&h[j][i]>=h[j][i-1])
    cout<<j-1<<" "<<i-1<<"\n";
}
int main()
{
	int m,n;
	cin>>m>>n;
	int h[21][21];
	for(int i=1;i<m+1;i++)
	{
		for(int j=1;j<n+1;j++)
		{
			cin>>h[i][j];
		}
	}
	for(int i=0;i<20;i++)
	{
		h[0][i]=0;
		h[i][0]=0;
		h[m+1][i]=0;
		h[i][n+1]=0;
	}
	for(int i=1;i<m+1;i++)
	{
		for(int j=1;j<n+1;j++)
		{
			
			if(h[i][j]>=h[i][j-1]&&h[i][j]>=h[i][j+1]&&h[i][j]>=h[i+1][j]&&h[i][j]>=h[i-1][j])
			{
				cout<<i-1<<" "<<j-1<<endl;
			}
		}
	}


	return 0;
}
int main()
{
 int a[22][22],b[400],c[400],i,j,k=0,m,n,s;
 scanf("%d %d",&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++)
   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])
   {
   printf("%d %d\n",i-1,j-1);

   }
  }
 }

return 0;
}
int main()
{
    int a[ROW][COL],m,n,k,i;
    scanf("%d%d",&m,&n);
    int b[N],c[N],j;
    for(k=0;k<m;k++){
        for(i=0;i<n;i++){
            scanf("%d",&(a[k][i]));
        }
    }
    for(k=0;k<m;k++){
        for(i=0;i<n;i++){
            if(k==0&&i==0)
            {
                if(a[k][i]>=a[k+1][i]&&a[k][i]>=a[k][i+1]) 
                printf("%d %d\n",k,i);
            }
            else if(k==0&&i==n-1)
            {
                if(a[k][i]>=a[k+1][i]&&a[k][i]>=a[k][i-1]) 
                printf("%d %d\n",k,i);
            }
            else if(k==m-1&&i==0)
            {
                if(a[k][i]>=a[k-1][i]&&a[k][i]>=a[k][i+1]) 
                printf("%d %d\n",k,i);
            }
            else if(k==m-1&&i==n-1)
            {
                if(a[k][i]>=a[k-1][i]&&a[k][i]>=a[k][i-1]) 
                printf("%d %d\n",k,i);
            }
            else if(i==0&&k>0&&k<m-1)
            {
                if(a[k][i]>=a[k-1][i]&&a[k][i]>=a[k][i+1]&&a[k][i]>=a[k+1][i]) 
                printf("%d %d\n",k,i);
            }
            else if(i==n-1&&k>0&&k<m-1)
            {
                if(a[k][i]>=a[k-1][i]&&a[k][i]>=a[k][i-1]&&a[k][i]>=a[k+1][i]) 
                printf("%d %d\n",k,i);
            }
            else if(k==0&&i>0&&i<n-1)
            {
                if(a[k][i]>=a[k][i+1]&&a[k][i]>=a[k][i-1]&&a[k][i]>=a[k+1][i]) 
                printf("%d %d\n",k,i);
            }
            else if(k==m-1&&i>0&&i<n-1)
            {
                if(a[k][i]>=a[k][i+1]&&a[k][i]>=a[k][i-1]&&a[k][i]>=a[k-1][i]) 
                printf("%d %d\n",k,i);
            }
            else 
            {
                if(a[k][i]>=a[k-1][i]&&a[k][i]>=a[k][i-1]&&a[k][i]>=a[k+1][i]&&a[k][i]>=a[k][i+1]) 
                printf("%d %d\n",k,i);
            }
        }
    }
   
    return 0;
}
int main(){
	int m,n,i,j;
	cin>>m>>n;
	const int M=m,N=n;
	int mount[M][N];
	for(i=0;i<m;i++)
		for(j=0;j<n;j++)cin>>mount[i][j];
	for(i=0;i<m;i++)
		for(j=0;j<n;j++){
			if(i>0)
				if(mount[i-1][j]>mount[i][j])continue;
			if(j>0)
				if(mount[i][j-1]>mount[i][j])continue;
			if(i<m-1)
				if(mount[i+1][j]>mount[i][j])continue;
			if(j<n-1)
				if(mount[i][j+1]>mount[i][j])continue;
			cout<<i<<' '<<j<<endl;
		}
	return 0;
}
void main()
{
	int i,j,m,n,a[30][30];
	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++)
	{
		if(i==0)
		{
			for(j=0;j<n;j++)
			{
				if(j==0)
				{
					if(a[0][0]>=a[0][1]&&a[0][0]>=a[1][0])
						printf("0 0\n");
				}
				else 
				{
					if(j==n-1)
						{
							if(a[0][n-1]>=a[0][n-2]&&a[0][n-1]>=a[1][n-1])
							printf("%d %d\n",i,j);
						}
					else
					{
						if(a[i][j]>=a[0][j-1]&&a[i][j]>=a[0][j+1]&&a[i][j]>=a[i+1][j])
						printf("%d %d\n",i,j);	
					}
				}
			}
		}
		else 
		{
			if(i<m-1)
			{
				for(j=0;j<n;j++)
				{
					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])
						printf("%d %d\n",i,j);
					}
					else
					{
						if(j<n-1)
						{
							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);
						}
						else
						{
							if(a[i][j]>=a[i-1][j]&&a[i][j]>=a[i+1][j]&&a[i][j]>=a[i][j-1])
							printf("%d %d\n",i,j);
						}
					}
				}
			}
			else
			{	
				for(j=0;j<n;j++)
				{
					if(j==0)
					{
						if(a[i][0]>=a[i][1]&&a[i][0]>=a[i-1][0])
						printf("%d %d\n",i,j);
					}
					else
					{
						if(j==n-1)
						{
							if(a[i][n-1]>=a[i][n-2]&&a[i][n-1]>=a[i-1][n-1])
							printf("%d %d\n",i,j);
						}
						else
						{
							if(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);
						}
					}
				}
			}
		}
			}
		
}