#include<bits/stdc++.h>
using namespace std;
int a[15][15],n,m,t=1,k=1,sx,sy,fx,fy,o;
int ans[5000][2];
void dfs(int x,int y)
{
if(x<1||x>n) return;
if(y<1||y>m) return;
if(x==fx&&y==fy){
for(int l=1;l<=k;l++){
cout<<"("<<ans[l][0]<<","<<ans[l][1]<<")->";
if(l==k) cout<<"(5,6)";
}
cout<<endl;
return;
}
if(a[x][y]==0||a[x][y]==9) return;
o=a[x][y];
a[x][y]=9;
ans[k][0]=x;
ans[k][1]=y;
k++;
dfs(x+1,y);
dfs(x-1,y);
dfs(x,y+1);
dfs(x,y-1);
k--;
a[x][y]=o;
}
int main()
{
cin>>n>>m;
for(int j=1;j<=n;j++)
for(int e=1;e<=m;e++)
cin>>a[j][e];
cin>>sx>>sy>>fx>>fy;
if(a[fx][fy]==0)
{
cout<<-1;
return 0;
}
dfs(sx,sy);
}