#include <bits/stdc++.h>
using namespace std;
bool fun(pair<int, int> a, pair<int, int> b) {
  return (a.second - a.first > b.second - b.first);
}
int main() {
  int a1[5], a2[5], a3[5], a4[5];
  for (int i = 1; i <= 4; i++) cin >> a1[i];
  for (int i = 1; i <= 4; i++) cin >> a2[i];
  for (int i = 1; i <= 4; i++) cin >> a3[i];
  for (int i = 1; i <= 4; i++) cin >> a4[i];
  if (a1[1] == 1 && (a4[4] == 1 || a1[4] == 1)) {
    cout << "YES";
    return 0;
  } else if (a1[2] == 1 && (a3[4] == 1 || a1[4] == 1)) {
    cout << "YES";
    return 0;
  } else if (a1[3] == 1 && (a2[4] == 1 || a1[4] == 1)) {
    cout << "YES";
    return 0;
  } else if (a2[1] == 1 && (a1[4] == 1 || a2[4] == 1)) {
    cout << "YES";
    return 0;
  } else if (a2[2] == 1 && (a4[4] == 1 || a2[4] == 1)) {
    cout << "YES";
    return 0;
  } else if (a2[3] == 1 && (a3[4] == 1 || a2[4] == 1)) {
    cout << "YES";
    return 0;
  } else if (a3[1] == 1 && (a2[4] == 1 || a3[4] == 1)) {
    cout << "YES";
    return 0;
  } else if (a3[2] == 1 && (a1[4] == 1 || a3[4] == 1)) {
    cout << "YES";
    return 0;
  } else if (a3[3] == 1 && (a4[4] == 1 || a3[4] == 1)) {
    cout << "YES";
    return 0;
  } else if (a4[1] == 1 && (a3[4] == 1 || a4[4] == 1)) {
    cout << "YES";
    return 0;
  } else if (a4[2] == 1 && (a2[4] == 1 || a4[4] == 1)) {
    cout << "YES";
    return 0;
  } else if (a4[3] == 1 && (a1[4] == 1 || a4[4] == 1)) {
    cout << "YES";
    return 0;
  }
  cout << "NO";
}
