#include <bits/stdc++.h>
using namespace std;
int main() {
  int x[5][5];
  bool f = false;
  for (int i = 1; i <= 4; i++) {
    for (int j = 1; j <= 4; j++) {
      cin >> x[i][j];
    }
  }
  for (int i = 1; i <= 4; i++) {
    if (x[i][4]) {
      for (int j = 1; j <= 3; j++) {
        if (x[i][j]) f = true;
      }
      for (int j = 1; j <= 3; j++) {
        int p = i + j;
        if (p > 4) p -= 4;
        if (x[p][j]) f = true;
      }
    }
  }
  if (f)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
