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