#include <bits/stdc++.h>
using namespace std;
const int RNG = 100003;
const int MOD = 1e9 + 7;
const double pi = 2 * acos(0.0);
inline int _Int() {
  int x;
  scanf("%d", &x);
  return x;
}
inline long long _LLi() {
  long long x;
  scanf("%lld", &x);
  return x;
}
void pruts() {
  puts("-1");
  exit(EXIT_SUCCESS);
}
int dirX[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dirY[] = {0, 1, 0, -1, 1, -1, -1, 1};
int rX[] = {1, 1, 2, 2, -1, -1, -2, -2};
int rY[] = {2, -2, 1, -1, 2, -2, 1, -1};
template <class T>
T tri_Area(T x1, T y1, T x2, T y2, T x3, T y3) {
  return abs(x1 * (y2 - y3) - y1 * (x2 - x3) + (x2 * y3 - x3 * y2));
};
template <class T>
T Distance(T x1, T y1, T x2, T y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
};
template <class T>
T bigMod(T n, T p, T m) {
  if (p == 0) return 1;
  if (p & 1) return (n * bigMod(n, p - 1, m)) % m;
  T x = bigMod(n, p / 2, m);
  return (x * x) % m;
};
int Case;
int sset(int N, int pos) { return N = N | (1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
int A[5][5];
void Hunger() {
  for (int i = 1; i <= 4; i++) {
    for (int j = 1; j <= 4; j++) A[i][j] = _Int();
  }
  if (A[1][4] == 1) {
    if (A[1][1] || A[1][2] || A[1][3] || A[2][1] || A[3][2] || A[4][3]) {
      puts("YES");
      return;
    }
  }
  if (A[2][4] == 1) {
    if (A[2][1] || A[2][2] || A[2][3] || A[3][1] || A[4][2] || A[1][3]) {
      puts("YES");
      return;
    }
  }
  if (A[3][4] == 1) {
    if (A[3][1] || A[3][2] || A[3][3] || A[1][2] || A[2][3] || A[4][1]) {
      puts("YES");
      return;
    }
  }
  if (A[4][4] == 1) {
    if (A[4][1] || A[4][2] || A[4][3] || A[1][1] || A[2][2] || A[3][3]) {
      puts("YES");
      return;
    }
  }
  puts("NO");
}
int main() {
  Hunger();
  return 0;
}
