#include <bits/stdc++.h>
int main() {
  int i, s1[4], s2[4], s3[4], s4[4], k = 0;
  for (i = 0; i < 4; i++) scanf("%d", &s1[i]);
  for (i = 0; i < 4; i++) scanf("%d", &s2[i]);
  for (i = 0; i < 4; i++) scanf("%d", &s3[i]);
  for (i = 0; i < 4; i++) scanf("%d", &s4[i]);
  if (s1[3] == 1) {
    if (s1[0] == 1 || s1[1] == 1 || s1[2] == 1)
      k = 1;
    else if (s3[1] == 1)
      k = 1;
    else if (s4[2] == 1)
      k = 1;
    else if (s2[0] == 1)
      k = 1;
  }
  if (s2[3] == 1) {
    if (s2[0] == 1 || s2[1] == 1 || s2[2] == 1)
      k = 1;
    else if (s4[1] == 1)
      k = 1;
    else if (s1[2] == 1)
      k = 1;
    else if (s3[0] == 1)
      k = 1;
  }
  if (s3[3] == 1) {
    if (s3[0] == 1 || s3[1] == 1 || s3[2] == 1)
      k = 1;
    else if (s1[1] == 1)
      k = 1;
    else if (s2[2] == 1)
      k = 1;
    else if (s4[0] == 1)
      k = 1;
  }
  if (s4[3] == 1) {
    if (s4[0] == 1 || s4[1] == 1 || s4[2] == 1)
      k = 1;
    else if (s2[1] == 1)
      k = 1;
    else if (s3[2] == 1)
      k = 1;
    else if (s1[0] == 1)
      k = 1;
  }
  if (k == 1)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
