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