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