#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j;
  vector<vector<int> > res(4, vector<int>(4));
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      cin >> res[i][j];
    }
  }
  for (i = 0; i < 4; i++) {
    if (res[i][3] == 1) {
      for (j = 0; j < 3; j++) {
        if (res[i][j] == 1) {
          cout << "YES";
          return 0;
        }
      }
      if (i == 0) {
        if (res[1][0] || res[2][1] || res[3][2]) {
          cout << "YES";
          return 0;
        }
      }
      if (i == 1) {
        if (res[0][2] || res[2][0] || res[3][1]) {
          cout << "YES";
          return 0;
        }
      }
      if (i == 2) {
        if (res[0][1] || res[1][2] || res[3][0]) {
          cout << "YES";
          return 0;
        }
      }
      if (i == 3) {
        if (res[0][0] || res[1][1] || res[2][2]) {
          cout << "YES";
          return 0;
        }
      }
    }
  }
  cout << "NO";
  return 0;
}
