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