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