semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int m,n;
	int a[20][20];
	int 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++)
		{
			int t=1;
			if(i-1>=0)
			{
				if(a[i][j]<a[i-1][j])
					t=0;
			}
			if(i+1<m)
			{
				if(a[i][j]<a[i+1][j])
					t=0;
			}
            if(j-1>=0)
			{
				if(a[i][j]<a[i][j-1])
					t=0;
			}
			if(j+1<n)
			{
				if(a[i][j]<a[i][j+1])
					t=0;
			}
			if(t==1)
				printf("%d %d\n",i,j);
		}
	}
	return 0;
}
int main ()
{
	int i,j,m,n,h,g,l,k,p=0,z=0;
	 
	int sz[20][20];

	int e[400],f[400];
	
	scanf("%d%d",&m,&n);
	for(i=0;i<m;i++){
		for(j=0;j<n;j++){
			scanf("%d",&sz[i][j]);
	}
	}
	for(i=1;i<m-1;i++){
		for(j=1;j<n-1;j++){
			if(sz[i][j]>=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]){
				e[z]=i;
				f[z]=j;
				z++;
				

				
			}
		}
	}

			if(sz[0][0]>=sz[0][1]&&sz[0][0]>=sz[1][0]){

				e[z]=0;
				f[z]=0;
				z++;
				
			}
			if(sz[m-1][0]>=sz[m-2][0]&&sz[m-1][0]>=sz[m-1][1]){
				e[z]=m-1;
				f[z]=0;
				z++;
				
			}
			if(sz[0][n-1]>=sz[0][n-2]&&sz[0][n-1]>=sz[1][n-1]){
				e[z]=0;
				f[z]=n-1;
				z++;
				
			}
			if(sz[m-1][n-1]>=sz[m-2][n-1]&&sz[m-1][n-1]>=sz[m-1][n-2]){
				e[z]=m-1;
				f[z]=n-1;
				z++;
				
			}

	for(i=1;i<m-1;i++){
		if(sz[i][0]>=sz[i+1][0]&&sz[i][0]>=sz[i-1][0]&&sz[i][0]>=sz[i][1]){
				e[z]=i;
				f[z]=0;
				z++;
			
		}
	}
	for(j=1;j<n-1;j++){
			if(sz[0][j]>=sz[0][j+1]&&sz[0][j]>=sz[0][j-1]&&sz[0][j]>=sz[1][j]){
				e[z]=0;
				f[z]=j;
				z++;
				
		}
	}
	for(i=1;i<m-1;i++){
		if(sz[i][n-1]>=sz[i+1][n-1]&&sz[i][n-1]>=sz[i-1][n-1]&&sz[i][n-1]>=sz[i][n-2]){
				e[z]=i;
				f[z]=n-1;
				z++;
				
		}
	}
	for(j=1;j<n-1;j++){
		if(sz[m-1][j]>=sz[m-1][j+1]&&sz[m-1][j]>=sz[m-1][j-1]&&sz[m-1][j]>=sz[m-2][j]){
				e[z]=m-1;
				f[z]=j;
				z++;
				
		}
		}
	for(k=1;k<=z;k++){
		for(i=0;i<z-k;i++){
			if(e[i]>e[i+1]){
				g=e[i];
				e[i]=e[i+1];
				e[i+1]=g;
				h=f[i];
				f[i]=f[i+1];
				f[i+1]=h;
				
	}
	}
	}
	for(k=1;k<=z;k++){
		for(p=0;p<z-k;p++){
			 if(f[p]>f[p+1]&&e[p]==e[p+1]){
				l=f[p];
				f[p]=f[p+1];
				f[p+1]=l;
				

			}
		}
	}
    
	for(p=0;p<z;p++){
	
		printf("%d %d\n",e[p],f[p]);
	}
	

	return 0;

}
int main()
{
	int i,j,m,n,a[100][100]={0};
	cin >> m >> n;
	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+1]-a[i][j]<=0 && a[i+1][j]-a[i][j]<=0 && a[i-1][j]-a[i][j]<=0 && a[i][j-1]-a[i][j]<=0)
				cout << i-1 << " " << j-1 << endl;;
	return 0;
}
int main()
{
	int m,n,h[21][21]={0},i,j;
	scanf("%d %d",&m,&n);
	for(i=1;i<=m;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(j==1)
				scanf("%d",&h[i][j]);
			else if(j!=1)
				scanf(" %d",&h[i][j]);
		}
	}
	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][j-1]&&h[i][j]>=h[i+1][j]&&h[i][j]>=h[i][j+1])
				printf("%d %d\n",i-1,j-1);
		}
	}

}
int main()
{
	int i,j,m,n,num[20][20]={0},flag[20][20]={0};
	cin>>m>>n;
	for(i=0;i<m;i++)
		for(j=0;j<n;j++)
			cin>>num[i][j];
	if(num[0][0]>=num[0][1]&&num[0][0]>=num[1][0])
		flag[0][0]=1;
	if(num[0][n-1]>=num[1][n-1]&&num[0][n-1]>=num[0][n-2])
		flag[0][n-1]=1;
    if(num[m-1][0]>=num[m-2][0]&&num[m-1][0]>=num[m-1][1])
		flag[m-1][0]=1;
	if(num[m-1][n-1]>=num[m-1][n-2]&&num[m-1][n-1]>=num[m-2][n-1])
		flag[m-1][n-1]=1;
	for(i=1;i<n-1;i++)
		if(num[0][i]>=num[0][i-1]&&num[0][i]>=num[0][i+1]&&num[0][i]>=num[1][i])
			flag[0][i]=1;
	for(i=1;i<n-1;i++)
		if(num[m-1][i]>=num[m-1][i-1]&&num[m-1][i]>=num[m-1][i+1]&&num[m-1][i]>=num[m-2][i])
			flag[m-1][i]=1;
	for(i=1;i<m-1;i++)
		if(num[i][0]>=num[i-1][0]&&num[i][0]>=num[i+1][0]&&num[i][0]>=num[i][1])
			flag[i][0]=1;
	for(i=1;i<m-1;i++)
		if(num[i][n-1]>=num[i-1][n-1]&&num[i][n-1]>=num[i+1][n-1]&&num[i][n-1]>=num[i][n-2])
			flag[i][n-1]=1;
	for(i=1;i<m-1;i++)
		for(j=1;j<n-1;j++)
			if(num[i][j]>=num[i-1][j]&&num[i][j]>=num[i+1][j]&&num[i][j]>=num[i][j-1]&&num[i][j]>=num[i][j+1])
				flag[i][j]=1;
	for(i=0;i<m;i++)
		for(j=0;j<n;j++)
			if(flag[i][j]==1)
				cout<<i<<" "<<j<<endl;
	return 0;
}
int main()
{
int dk[MAX+2][MAX+2];
int i,j,m,n;
scanf("%d %d", &m,&n);
for(i=1;i<=m;i++){
	for(j=1;j<=n;j++)
		scanf("%d",&dk[i][j]);
}
for(i=1;i<=m;i++)
    dk[i][0]=dk[i][n+1]=0;
for(j=1;j<=n;j++)
    dk[0][j]=dk[m+1][j]=0;
for(i=1;i<=m;i++){
	for(j=1;j<=n;j++){
		if(dk[i][j]>=dk[i+1][j] && dk[i][j]>=dk[i-1][j] && dk[i][j]>=dk[i][j+1] && dk[i][j]>=dk[i][j-1])
        printf("%d %d\n",i-1,j-1);
}
}	
return 0;
}
int main()
{
	int		board[100][100] = {0};
	int		boards[100][100]  = {0};
	int		i, j, n, m;
	cin >> m >> n;

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

	for (i = 2; i <= m + 1; i ++)
	{
		for (j = 2; j <= n + 1; j ++)
		{
			int	s1 = (board[i][j] >= board[i][j + 1]);
			int	s2 = (board[i][j] >= board[i][j - 1]);
			int	s3 = (board[i][j] >= board[i + 1][j]);
			int	s4 = (board[i][j] >= board[i - 1][j]);
			if(s1 + s2 + s3 + s4 == 4)
			{
				boards[i][j] = 1;
			}
		}
	}
	
	for (i = 2; i <= m + 1; i ++)
	{
		for (j = 2; j <= n + 1; j ++)
		{
			if(boards[i][j] == 1)
			{
				cout << i - 2 << " " << j - 2 << endl;
			}
		}
	
	}


return 0;
}
// lp.cpp : Defines the entry point for the console application.
//
// ??????.cpp : Defines the entry point for the console application.
//

int main()
{

	int m,n,i,j,a[100][100];
	cin>>m>>n;
	memset(a,0,10000);
	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;
		}
		return 0;
}
int main()
{
	int x, y, a[23][23]={0}, i, j ;
	cin >> x >> y ;
	for (i = 1 ; i < x+1 ; i++)
	{
		for (j = 1 ; j < y+1 ; j++)
		{
			cin >> a[i][j] ;
		}
	}
	for (i = 1 ; i < x +1 ; i++)
	{
		for (j = 1 ; j < y+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 height[20][20]={0},m,n;    //????height???????
   cin>>m>>n;
   int i,j;
   for(i=0;i<m;i++)
   {
	   for(j=0;j<n;j++) cin>>height[i][j];
   }
   int judge,piece;
   for(i=0;i<m;i++)
   {
	   for(j=0;j<n;j++)
	   {
		   piece=0;
		   judge=0;
		   if(i>=1) { judge+=(height[i][j]>=height[i-1][j]);piece++;}
		   if(i<m-1) { judge+=(height[i][j]>=height[i+1][j]);piece++;}
		   if(j>=1) { judge+=(height[i][j]>=height[i][j-1]); piece++;}
		   if(j<n-1){ judge+=(height[i][j]>=height[i][j+1]);piece++;}   //????????????????????????piece??????,judge??????????
		   if(judge==piece)
		   {
			   cout<<i<<" "<<j<<endl;  //????????????????????
		   }

	   }
   }


	return 0;
}
main()
{
	int m,n,i,j,k=0;
	int di[20][20],ding[400][2];
	scanf("%d%d",&m,&n);
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		scanf("%d",&di[i][j]);
	}
	if(di[0][0]>=di[1][0]&&di[0][0]>=di[0][1])
	{ding[k][0]=0;ding[k][1]=0;k++;}
	for(j=1;j<n-1;j++)
	{
		if(di[0][j]>=di[0][j-1]&&di[0][j]>=di[0][j+1]&&di[0][j]>=di[1][j])
		{
			ding[k][0]=0;ding[k][1]=j;k++;
		}
	}
	if(di[0][n-1]>=di[0][n-2]&&di[0][n-1]>=di[1][n-1])
	{ding[k][0]=0;ding[k][1]=n-1;k++;}
	for(i=1;i<m-1;i++)
	{
		if(di[i][0]>=di[i-1][0]&&di[i][0]>=di[i][1]&&di[i][0]>=di[i+1][0])
		{ding[k][0]=i;ding[k][1]=0;k++;}
		for(j=1;j<n-1;j++)
		{
			if(di[i][j]>=di[i][j-1]&&di[i][j]>=di[i][j+1]&&di[i][j]>=di[i+1][j]&&di[i][j]>=di[i-1][j])
		{
			ding[k][0]=i;ding[k][1]=j;k++;
		}
		}
		if(di[i][n-1]>=di[i][n-2]&&di[i][n-1]>=di[i+1][n-1]&&di[i][n-1]>=di[i-1][n-1])
	   {ding[k][0]=i;ding[k][1]=n-1;k++;}
	}
	if(di[m-1][0]>=di[m-2][0]&&di[m-1][0]>=di[m-1][1])
	{ding[k][0]=m-1;ding[k][1]=0;k++;}
	for(j=1;j<n-1;j++)
	{
		if(di[m-1][j]>=di[m-1][j-1]&&di[m-1][j]>=di[m-1][j+1]&&di[m-1][j]>=di[m-2][j])
		{
			ding[k][0]=m-1;ding[k][1]=j;k++;
		}
	}
	if(di[m-1][n-1]>=di[m-1][n-2]&&di[m-1][n-1]>=di[m-2][n-1])
	{ding[k][0]=m-1;ding[k][1]=n-1;k++;}
	for(i=0;i<k;i++)
   printf("%d %d\n",ding[i][0],ding[i][1]);
}
int main()
{
	int m, n, a[20][20], i = 0,j,k,x[1000]={0}, y[1000]={0};
	cin >> m >> n;
	for (i = 0; i < m; i++)
	{
		for (j = 0; j < n; j++)
		{
			cin >> a[i][j];
		}
	}
	i = 0;
	if (a[0][0] >= a[1][0] && a[0][0] >= a[0][1])
	{
		x[i] = 0;
		y[i] = 0;
		i++;
	}
	for (j = 1; j < n - 1; j++)
	{
		if (a[0][j] >= a[1][j] && a[0][j]  >=a[0][j - 1] && a[0][j] >= a[0][j + 1])
		{
			x[i] = 0;
			y[i] = j;
			i++;
		}
	}
	if (a[0][n - 1] >= a[0][n - 2] && a[0][n - 1] >=a[1][n - 1])
	{
		x[i] = 0;
		y[i] = n - 1;
		i++;
	}
	for (k = 1; k < m - 1; k++)
	{
		if (a[k][0] >= a[k - 1][0] && a[k][0] >= a[k + 1][0] && a[k][0] >= a[k][1])
		{
			x[i] = k;
			y[i] = 0;
			i++;
		}
		for (j = 1; j < n - 1; j++)
		{
			if (a[k][j] >= a[k + 1][j] && a[k][j] >= a[k - 1][j] && a[k][j] >= a[k][j - 1] && a[k][j] >= a[k][j + 1])
			{
				x[i] = k;
				y[i] = j;
				i++;
			}
		}
		if (a[k][n - 1] >= a[k - 1][n - 1] && a[k][n - 1] >= a[k + 1][n - 1] && a[k][n - 1] >= a[k][n - 2])
		{
			x[i] = k;
			y[i] = n - 1;
			i++;
		}
	}
	if (a[m - 1][0] >= a[m - 2][0] && a[m - 1][0] >= a[m - 1][1])
	{
		x[i] = m - 1;
		y[i] = 0;
		i++;
	}
	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])
		{
			x[i] = m - 1;
			y[i] = j;
			i++;
		}
	}
	if (a[m -  1][n - 1] >= a[m - 2][n - 1] && a[m - 1][n - 1] >= a[m - 1][n - 2])
	{
		x[i] = m - 1;
		y[i] = n - 1;
		i++;
	}
	for (j = 0; j < i; j++)
	{
		cout << x[j] << " " << y[j] << endl;
	}
	return 0;
}
int main(){
	int m,n,a[20][20],i,u;
	scanf("%d%d",&m,&n);
	for(i=0;i<m;i++){
		for(u=0;u<n;u++){
			scanf("%d",&a[i][u]);
		}
	}
	for(i=0;i<m;i++){
		for(u=0;u<n;u++){
			if(i!=0&&u!=0&&i!=m-1&&u!=n-1){
				if(a[i][u]>=a[i+1][u]&&a[i][u]>=a[i-1][u]&&a[i][u]>=a[i][u+1]&&a[i][u]>=a[i][u-1]){
					printf("%d %d\n",i,u);
				}
			}else if(i==0&&u!=0&&u!=n-1){
				if(a[i][u]>=a[i+1][u]&&a[i][u]>=a[i][u+1]&&a[i][u]>=a[i][u-1]){
					printf("%d %d\n",i,u);
				}
			}else if(i==m-1&&u!=0&&u!=n-1){
				if(a[i][u]>=a[i-1][u]&&a[i][u]>=a[i][u+1]&&a[i][u]>=a[i][u-1]){
					printf("%d %d\n",i,u);
				}
			}else if(u==0&&i!=0&&i!=m-1){
				if(a[i][u]>=a[i+1][u]&&a[i][u]>=a[i-1][u]&&a[i][u]>=a[i][u+1]){
					printf("%d %d\n",i,u);
				}
			}else if(u==n-1&&i!=0&&i!=m-1){
				if(a[i][u]>=a[i+1][u]&&a[i][u]>=a[i-1][u]&&a[i][u]>=a[i][u-1]){
					printf("%d %d\n",i,u);
				}
			}else if(i==0&&u==0){
				if(a[i][u]>=a[i+1][u]&&a[i][u]>=a[i][u+1]){
					printf("%d %d\n",i,u);
				}
			}else if(i==0&&u==n-1){
				if(a[i][u]>=a[i+1][u]&&a[i][u]>=a[i][u-1]){
					printf("%d %d\n",i,u);
				}
			}else if(u==0&&i==m-1){
				if(a[i][u]>=a[i-1][u]&&a[i][u]>=a[i][u+1]){
					printf("%d %d\n",i,u);
				}
			}else{
				if(a[i][u]>=a[i-1][u]&&a[i][u]>=a[i][u-1]){
					printf("%d %d\n",i,u);
				}
			}
		}
	}
	return 0;
}
int main(){
    int i,j,m,n,x;
    int shandi[LEN][WIDTH],shanding[LEN][2];
    scanf("%d%d",&m,&n);
    for(i=1;i<m+1;i++){
        for(j=1;j<n+1;j++){
            scanf("%d",&(shandi[i][j]));
        }
    }
    for(j=0;j<m+2;j++){
        shandi[j][0]=0;
    }
    for(j=0;j<m+2;j++){
        shandi[j][n+1]=0;
    }
    for(j=0;j<n+2;j++){
        shandi[0][j]=0;
    }
    for(j=0;j<n+2;j++){
        shandi[m+1][j]=0;
    }
    x=0;
    for(i=1;i<m+1;i++){
        for(j=1;j<n+1;j++){
            if(shandi[i][j]>=shandi[i][j-1]&&shandi[i][j]>=shandi[i][j+1]&&shandi[i][j]>=shandi[i-1][j]&&shandi[i][j]>=shandi[i+1][j]){
                shanding[x][0]=i-1;
                shanding[x][1]=j-1;
                x++;
            }
        }
    }
    for(i=0;i<x;i++){
        printf("%d %d\n",shanding[i][0],shanding[i][1]);
    }
    return 0;
}
int main()
{
	int m, n,a[21][21],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++)
		{
			if ((i == 0) && (j == 0))
			{
				if ((a[i][j] >= a[i][j+1]) &&(a[i][j]>= a[i+1][j]))
					cout << i << ' ' << j << endl;
			}
			else 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;
			}
			else if ((i == m - 1) && (j == 0))
			{
				if ((a[i][j] >= a[i][j + 1]) && (a[i][j] >= a[i - 1][j]))
					cout << i << ' ' << j << endl;
			}
			else if ((i == m - 1) && (j == n - 1))
			{
				if ((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 - 1))
			{
				if ((a[i][j] >= a[i][j + 1]) && (a[i][j] >= a[i + 1][j]) && (a[i][j] >= a[i][j - 1]) )
					cout << i << ' ' << j << endl;
			}
			else if ((i == m-1) && (j != 0) && (j != n - 1))
			{
				if ((a[i][j] >= a[i][j + 1]) && (a[i][j] >= a[i - 1][j]) && (a[i][j] >= a[i][j - 1]))
					cout << i << ' ' << j << endl;
			}
			else if ((j == 0) && (i != 0) && (i != m - 1))
			{
				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-1) && (i != 0) && (i != m - 1))
			{
				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 ((a[i][j] >= a[i][j - 1]) && (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;
			}
		}
	}
	return 0;
}
int main(int argc, char *argv[])
{
    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("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][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-2][0]&&a[m-1][0]>=a[m-1][1]) printf("%d 0\n",m-1);
    for(j=1;j<n-1;j++){
                       if(a[m-1][j]>=a[m-2][j]&&a[m-1][j]>=a[m-1][j-1]&&a[m-1][j]>=a[m-1][j+1]) printf("%d %d\n",m-1,j);
                       }
    if(a[m-1][n-1]>=a[m-2][n-1]&&a[m-1][n-1]>=a[m-1][n-2]){
                                                           printf("%d %d\n",m-1,n-1);
                                                           }   
    return 0;
}
/*
 * fx11.cpp
 *
 *  Created on: 2013-1-12
 *      Author: SONY
 *      ????
 */
int main(){
   int m,n;
   cin>>m>>n;
   int a[m][n],i,j;
   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++)
	   {
		   int k=0;
		   if(i+1<m && a[i+1][j]<=a[i][j]) k++;
		   if(j+1<n && a[i][j+1]<=a[i][j]) k++;
		   if(i-1>=0 && a[i-1][j]<=a[i][j]) k++;
		   if(j-1>=0 && a[i][j-1]<=a[i][j]) k++;
		   if((i==0 && j==0)|| (i==0 && j==n-1)||(i==m-1&&j==0) ||(i==m-1 && j==n-1))
		   {
			   if(k==2) cout<<i<<" "<<j<<endl;
		   }
		   else{
			   if(i==0|| j==0 || i==m-1 || j==n-1)
		      {
			    if(k==3)  cout<<i<<" "<<j<<endl;
		       }
		      else {
		    	  if(k==4) cout<<i<<" "<<j<<endl;
		      }
	   }
   }
   }
return 0;
}
int main()
{
	int a[20][20],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[0][0]>=a[0][1] && a[0][0]>=a[1][0])
			{
				printf("%d %d\n",i,j);
			}
			else if(i==m-1 && j==n-1 && a[m-1][n-1]>=a[m-1][n-2] && a[m-1][n-1]>=a[m-2][n-1])
			{
				printf("%d %d\n",i,j);
			}
			else if(i==0 && j==n-1 && a[0][n-1]>=a[1][n-1] && a[0][n-1]>=a[0][n-2])
			{
				printf("%d %d\n",i,j);
			}
			else if(i==m-1 && j==0 && a[m-1][0]>=a[m-1][1] && a[m-1][0]>=a[m-2][0])
			{
				printf("%d %d\n",i,j);
			}
			else if (i==0 && j>0 && j<(n-1) && a[0][j]>=a[0][j-1] && a[0][j]>=a[0][j+1] && a[0][j]>=a[1][j])
			{
				printf("%d %d\n",i,j);
			}
			else if (j==0 && i>0 && i<(m-1) && a[i][0]>=a[i-1][0] && a[i][0]>=a[i+1][0] && a[i][0]>=a[i][1])
			{
				printf("%d %d\n",i,j);
			}
			else if (i==m-1 && j>0 && j<(n-1) && 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",i,j);
			}
			else if (j==n-1 && i>0 && i<(m-1) && 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,j);
			}
			else if (i>0 && i<(m-1) && j>0 && j<(n-1) && 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);
			}
		}
	return 0;
}
int main()
{
	int m[20][20], x, y, f;
	cin >> x >> y;
	for (int i = 0; i < x; i++)
		for (int j = 0; j < y; j++)
			cin >> m[i][j];
	for (int i = 0; i < x; i++)
		for (int j = 0; j < y; j++)
		{
			f = 0;
			if (i > 0)
			{
				if (m[i][j] >= m[i - 1][j])
					f++;
			}
			else
				f++;
			if (j > 0)
			{
				if (m[i][j] >= m[i][j - 1])
					f++;
			}
			else
				f++;
			if (i < x - 1)
			{
				if (m[i][j] >= m[i + 1][j])
					f++;
			}
			else
				f++;
			if (j < y - 1)
			{
				if (m[i][j] >= m[i][j + 1])
					f++;
			}
			else
				f++;
			if (f == 4)
				cout << i << " " << j << endl;
		}


	return 0;
}
int main(){
    int m,n,i,j;
	int a[25][25]={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(i>0&&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]&&a[i][j]>=a[i-1][j])
				    printf("%d %d\n",i,j);
			}
			else 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])
				    printf("%d %d\n",i,j);
			}
			else if(i==0&&j==0){
			    if(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){
			    if(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>0&&i<m-1){
			    if(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){
			    if(a[i][j]>=a[i][j+1]&&a[i][j]>=a[i-1][j])
				    printf("%d %d\n",i,j);
			}
			else if(j==n-1&&i>0&&i<m-1){
			    if(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){
			    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);
			}
			else if(i==m-1&&j==n-1){
			    if(a[i][j]>=a[i][j-1]&&a[i][j]>=a[i-1][j])
				    printf("%d %d\n",i,j);
			}
		}
	}
return 0;
}
int main()
{
	int m, n, i, j, h[20][20];
	cin >> n; cin >> m;
	for(i = 0; i < n; i++)
		for(j = 0; j < m; j++)
		{
			cin >> h[i][j];
		}
	if(h[0][0] >= h[0][1] && h[0][0] >= h[1][0])
		cout << "0 0"<< endl;
	for(j = 1; j < m - 1; j ++)
		{
			if( h[0][j] >= h[1][j] && h[0][j] >= h[0][j+1] && h[0][j] >= h[0][j - 1])
			cout << "0 " << j << endl;
		}
	if(h[0][m - 1] >= h[0][m - 2] && h[0][m - 1] >= h[1][m - 1])
		cout << "0 "<<m - 1 << endl;
	for(i = 1; i < n-1; i++)
	{	
		if(h[i][0] >= h[i - 1][0] && h[i][0] >= h[i + 1][0] && h[i][0] >= h[i][1])
			cout << i << " 0" << endl;
		for(j = 1; j < m - 1; 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])
			cout << i << " " << j << endl;
		}
		if(h[i][j] >= h[i - 1][j] && h[i][j] >= h[i + 1][j]  && h[i][j] >= h[i][j - 1])
			cout << i << " " << j << endl;
	}
	if(h[n - 1][0] >= h[n - 1][1] && h[n - 1][0] >= h[n - 2][0])
		cout <<n - 1<< " 0"<< endl;
	for(j = 1; j < m - 1; j ++)
		{
			if( h[n - 1][j] >= h[n -2][j] && h[n -1][j] >= h[n -1][j+1] && h[n - 1][j] >= h[n - 1][j - 1])
			cout << n - 1 <<" " <<j << endl;
		}
	if(h[n - 1][m - 1] >= h[n -1][m - 2] && h[n - 1][m - 1] >= h[n - 2][m - 1])
		cout << n - 1<<" "<<m - 1 << endl;
	return 0;
}
int main()
{
	int m, n, a[20][20], 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++)
		{
			if (i == 0)
			{
				if (j == 0)
				{
					if (a[i][j] >= a[i + 1][j] && a[i][j] >= a[i][j + 1])
						cout<<i<<' '<<j<<endl;
					else
						continue;
				}
				else if (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])
						cout<<i<<' '<<j<<endl;
					else
						continue;
				}
				else
				{
					if (a[i][j] >= a[i + 1][j] && a[i][j] >= a[i][j - 1])
						cout<<i<<' '<<j<<endl;
					else
						continue;
				}
			}
			else if (i < m - 1)
			{
				if (j == 0)
				{
					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
						continue;
				}
				else if (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;
					else
						continue;
				}
				else
				{
					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
						continue;
				}
			}
			else
			{

				if (j == 0)
				{
					if (a[i][j] >= a[i - 1][j] && a[i][j] >= a[i][j + 1])
						cout<<i<<' '<<j<<endl;
					else
						continue;
				}
				else if (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])
						cout<<i<<' '<<j<<endl;
					else
						continue;
				}
				else
				{
					if (a[i][j] >= a[i - 1][j] && a[i][j] >= a[i][j - 1])
						cout<<i<<' '<<j<<endl;
					else
						continue;
				}
			}
		}
	}
	return 0;
}
int main()
{
	int a[21][21];
	int m, n, i, j;
	cin >> m >> n;
	memset(a,0,sizeof(a));
	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)
			{
				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 - 1)
			{
				if (a[i][j] >= a[i][j - 1] && a[i][j] >= a[i + 1][j])
					cout << i << ' ' << j << endl;
			}
			else 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;
			}
			else 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;
			}
			else 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;
			}
			else 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;
			}
			else if (j == 0 && i != 0 && i != m - 1)
			{
				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 (j == n - 1 && i != 0 && i != m - 1)
			{
				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;
}