#include <bits/stdc++.h>
using namespace std;
int f[4][4], a[4];
int main() {
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> f[i][j];
      if (j < 3) a[i] |= f[i][j];
    }
  }
  for (int i = 0; i < 4; i++) a[(i + 3) % 4] |= f[i][0];
  for (int i = 0; i < 4; i++) a[(i + 1) % 4] |= f[i][2];
  for (int i = 0; i < 4; i++) a[(i + 2) % 4] |= f[i][1];
  for (int i = 0; i < 4; i++) {
    if (a[i] && f[i][3]) {
      puts("YES");
      return 0;
    }
  }
  puts("NO");
  return 0;
}
