#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int mat[4][4];
  int ler;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> ler;
      mat[i][j] = ler;
    }
  }
  bool atr = false;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 3; j++) {
      if (mat[i][j] == 1 && mat[i][3] == 1) {
        atr = true;
        break;
      }
    }
    if (atr) break;
  }
  if (atr) {
    cout << "YES" << endl;
  } else {
    if ((mat[0][1] == 1 && mat[2][3] == 1) ||
        (mat[0][3] == 1 && mat[2][1] == 1) ||
        (mat[1][1] == 1 && mat[3][3] == 1) ||
        (mat[1][3] == 1 && mat[3][1] == 1)) {
      cout << "YES" << endl;
    } else if ((mat[0][0] == 1 && mat[3][3] == 1) ||
               (mat[1][0] == 1 && mat[0][3] == 1) ||
               (mat[2][0] == 1 && mat[1][3] == 1) ||
               (mat[3][0] == 1 && mat[2][3] == 1)) {
      cout << "YES" << endl;
    } else if ((mat[0][2] == 1 && mat[1][3] == 1) ||
               (mat[1][2] == 1 && mat[2][3] == 1) ||
               (mat[2][2] == 1 && mat[3][3] == 1) ||
               (mat[3][2] == 1 && mat[0][3] == 1)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
