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