#include <bits/stdc++.h>
using namespace std;
const int N = 100007;
const int M = 15005;
const int offset = 7500;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
int T, n, m;
int k;
int s[10][10];
int main() {
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++) scanf("%d", &s[i][j]);
  int f = 0;
  for (int i = 0; i < 4; i++) {
    if (s[i][3] == 1) {
      if (s[i][0] || s[i][1] || s[i][2]) f = 1;
      if (s[(i + 1) % 4][0] || s[(i + 2) % 4][1] || s[(i + 3) % 4][2]) f = 1;
    }
  }
  if (f)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
