#include <bits/stdc++.h>
using namespace std;
int n;
long long ft[10005];
long long query(int b) {
  long long s = 0;
  for (; b > 0; b -= (b & -b)) s += ft[b];
  return s;
}
void update(int p, int v) {
  for (; p <= n; p += (p & -p)) ft[p] += v;
}
int main() {
  int s[4][4];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> s[i][j];
    }
  }
  for (int i = 0; i < 4; i++) {
    if (s[i][3]) {
      if (s[i][0] + s[i][1] + s[i][2]) {
        cout << "YES";
        return 0;
      }
      if (s[(i + 1) % 4][0] + s[(i + 2) % 4][1] + s[(i + 3) % 4][2]) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
