#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  bool a[4][4];
  for (int i = 0; i < 4; i++) {
    for (int g = 0; g < 4; g++) {
      cin >> a[i][g];
    }
  }
  bool b = 0;
  for (int i = 0; i < 4; i++) {
    if (a[i][3] && (a[i][0] || a[i][1] || a[i][2])) b = 1;
  }
  if (a[0][3] && (a[1][0] || a[2][1] || a[3][2])) b = 1;
  if (a[1][3] && (a[0][2] || a[2][0] || a[3][1])) b = 1;
  if (a[2][3] && (a[1][2] || a[0][1] || a[3][0])) b = 1;
  if (a[3][3] && (a[0][0] || a[1][1] || a[2][2])) b = 1;
  cout << (b ? "YES" : "NO");
}
