#include <bits/stdc++.h>
using namespace std;
int main() {
  int lll, mmm, nnn;
  int ab[16];
  for (int i = 0; i < 16; i++) cin >> ab[i];
  if ((ab[0] == ab[3] && ab[0] == 1) || (ab[1] == ab[3] && ab[1] == 1) ||
      (ab[2] == ab[3] && ab[2] == 1)) {
    cout << "YES";
    return 0;
  }
  if ((ab[4] == ab[7] && ab[4] == 1) || (ab[5] == ab[7] && ab[5] == 1) ||
      (ab[6] == ab[7] && ab[6] == 1)) {
    cout << "YES";
    return 0;
  }
  if ((ab[8] == ab[11] && ab[8] == 1) || (ab[9] == ab[11] && ab[9] == 1) ||
      (ab[10] == ab[11] && ab[10] == 1)) {
    cout << "YES";
    return 0;
  }
  if ((ab[12] == ab[15] && ab[12] == 1) || (ab[13] == ab[15] && ab[13] == 1) ||
      (ab[14] == ab[15] && ab[14] == 1)) {
    cout << "YES";
    return 0;
  }
  if ((ab[0] == ab[15] && ab[0] == 1) || (ab[1] == ab[11] && ab[1] == 1) ||
      (ab[2] == ab[7] && ab[2] == 1)) {
    cout << "YES";
    return 0;
  }
  if ((ab[4] == ab[3] && ab[4] == 1) || (ab[5] == ab[15] && ab[5] == 1) ||
      (ab[6] == ab[11] && ab[6] == 1)) {
    cout << "YES";
    return 0;
  }
  if ((ab[8] == ab[7] && ab[8] == 1) || (ab[9] == ab[3] && ab[9] == 1) ||
      (ab[10] == ab[15] && ab[10] == 1)) {
    cout << "YES";
    return 0;
  }
  if ((ab[12] == ab[11] && ab[12] == 1) || (ab[13] == ab[7] && ab[13] == 1) ||
      (ab[14] == ab[3] && ab[14] == 1)) {
    cout << "YES";
    return 0;
  }
  cout << "NO";
  return 0;
}
