#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[4][4];
  bool bb = 0;
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++) cin >> a[i][j];
  if (a[0][3] == 1 && (a[0][0] == 1 || a[0][1] == 1 || a[0][2] == 1 ||
                       a[1][0] == 1 || a[2][1] || a[3][2] == 1))
    bb = 1;
  else if (a[1][3] == 1 && (a[1][0] == 1 || a[1][1] == 1 || a[1][2] == 1 ||
                            a[0][2] == 1 || a[2][0] == 1 || a[3][1] == 1))
    bb = 1;
  else if (a[2][3] == 1 && (a[2][0] == 1 || a[2][1] == 1 || a[2][2] == 1 ||
                            a[0][1] == 1 || a[1][2] == 1 || a[3][0] == 1))
    bb = 1;
  else if (a[3][3] == 1 && (a[3][0] == 1 || a[3][1] == 1 || a[3][2] == 1 ||
                            a[0][0] == 1 || a[1][1] == 1 || a[2][2] == 1))
    bb = 1;
  if (bb == 1)
    cout << "YES";
  else
    cout << "NO";
}
