#include
using namespace std;
#define N 6
bool canExitRecursive( int arr[N][N], int x, int y )
{
int height = 6 - 1;
int width = 6 -1;
if( x < 0 || x > width || y < 0 || y > height )
return false;
if( arr[y][x] == 1 )
return false;
if( x == width && y == height )
return true;
arr[y][x] = 1;
return canExitRecursive( arr, x + 1, y ) ||
canExitRecursive( arr, x, y + 1 ) ||
canExitRecursive( arr, x - 1, y ) ||
canExitRecursive( arr, x, y - 1 );
}
int main()
{
int maze[N][N];
for(int i=0;i<N;i++)
{
for(int j=0;j<N;j++)
{
cin>>maze[i][j];
}
}
if(canExitRecursive(maze,0,0)==true)
cout<<"Yes";
else
cout<<"No";
}