#include
int main(){
int row,col;
scanf("%d %d",&row,&col);
int a[100][100];
int i,j;
for(i=j=0;i
for(;j
scanf("%d",&a[i][j]);
}
}
for(i=j=0;(i
if(row==1){
for(;j
printf("%d\n",a[1][j]);
}
break;
}
if(col==1){
for(i=j=0;i
printf("%d\n",a[i][1]);
}
break;
}
for(i=j=0;j
printf("%d\n",a[i][j]);
}
for(j=col-1,i=1;i
printf("%d\n",a[i][j]);
}
for(j=col-2,i=row-1;j>=0;j--){
printf("%d\n",a[i][j]);
}
for(i=row-2,j=0;i>0;i--){
printf("%d\n",a[i][j]);
}
a[i][j]=a[i+1][j+1];
row-=2;
col-=2;
if(row==0||col==0)break;
}
return 0;
}