#include <bits/stdc++.h>
using namespace std;
int light[4][4];
int main() {
  while (cin >> light[0][0] >> light[0][1] >> light[0][2] >> light[0][3]) {
    for (int i = 1; i < 4; ++i) {
      for (int j = 0; j < 4; ++j) {
        cin >> light[i][j];
      }
    }
    bool ok = true;
    for (int i = 0; i < 4; ++i) {
      for (int j = 0; j < 4; ++j) {
        if (light[i][3] == 1) {
          int val = 0;
          for (int k = 0; k < 3; ++k) {
            val |= light[i][k];
          }
          val |= light[(i + 1) % 4][0];
          val |= light[(i + 2) % 4][1];
          val |= light[(i + 3) % 4][2];
          if (val == 1) {
            ok = false;
          }
        }
      }
    }
    if (!ok)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
