#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool getnum(T& x) {
  short sign = 1;
  x = 0;
  char c;
  do c = getchar();
  while (c == ' ' || c == '\n');
  if (c == EOF) return false;
  if (c == '-')
    sign = -1;
  else
    x = c - '0';
  for (c = getchar(); '0' <= c && c <= '9';
       (x = x * 10 + c - '0', c = getchar()))
    ;
  x *= sign;
  return true;
}
template <class T>
inline bool _R(T& x) {
  return (bool)(cin >> x);
}
inline bool _R(int& x) { return getnum(x); }
inline bool _R(unsigned& x) { return getnum(x); }
inline bool _R(long long& x) { return getnum(x); }
inline bool _R(unsigned long long& x) { return getnum(x); }
inline bool _R(double& x) { return scanf("%lf", &x); }
inline bool _R(char& x) { return scanf("%c", &x); }
inline bool _R(char* x) { return scanf("%s", x); }
template <class T>
inline bool _W(const T& x) {
  cout << x;
  return 0;
}
inline bool _W(const int& x) {
  printf("%d", x);
  return 0;
}
inline bool _W(const long long& x) {
  printf("%lld", x);
  return 0;
}
inline bool _W(const unsigned long long& x) {
  printf("%llu", x);
  return 0;
}
inline bool _W(const double& x) {
  printf("%.16f", x);
  return 0;
}
inline bool _W(const char& x) {
  putchar(x);
  return 0;
}
inline bool _W(const char* x) {
  int i = 0;
  while (x[i]) putchar(x[i++]);
  return 0;
}
inline bool _W(const string& x) {
  int i = 0;
  while (x[i]) putchar(x[i++]);
  return 0;
}
template <class T, class U>
inline bool _W(const pair<T, U>& x) {
  _W(x.first);
  putchar(' ');
  _W(x.second);
  return 0;
}
template <class T>
inline bool _W(const vector<T>& x) {
  for (typename vector<T>::iterator i = x.begin(); i != x.end(); _W(*i++))
    if (i != x.cbegin()) putchar(' ');
  return 0;
}
const int movex[] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int movey[] = {-1, -1, -1, 0, 1, 1, 1, 0};
int main() {
  bool arr[4][4];
  for (int i = 0; i < 4; ++i) {
    for (int j = 0; j < 4; ++j) {
      (_R(arr[i][j]));
    }
  }
  for (int i = 0; i < 4; ++i) {
    if (arr[i][0] && (arr[(i + 3) % 4][3]) ||
        arr[i][1] && arr[(i + 2) % 4][3] || arr[i][2] && arr[(i + 1) % 4][3] ||
        (arr[i][0] || arr[i][1] || arr[i][2]) && arr[i][3])
      return (_W("YES") && (_W('\n')));
  }
  (_W("NO") && (_W('\n')));
  return 0;
}
