#include <bits/stdc++.h>
using namespace std;
long long int modpow(long long int a, long long int n, long long int temp) {
  long long int res = 1, y = a;
  while (n > 0) {
    if (n & 1) res = (res * y) % temp;
    y = (y * y) % temp;
    n /= 2;
  }
  return res % temp;
}
int main() {
  int a[4][4];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 3; j++) {
      if (a[i][j] == 1) {
        if (a[(i - j - 1 + 4) % 4][3] == 1 || a[i][3] == 1) {
          cout << "YES" << endl;
          return 0;
        }
        cerr << "i"
             << ": " << i << " | "
             << "j"
             << ": " << j << " | "
             << "(i - j - 1 + 4) % 4"
             << ": " << (i - j - 1 + 4) % 4 << endl;
        ;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
