#include <bits/stdc++.h>
using namespace std;
char s[5][5];
int main() {
  for (int i = 1; i <= 4; i++) {
    for (int j = 1; j <= 4; j++) {
      int a;
      scanf("%d", &a);
      s[i][j] = a + '0';
    }
  }
  if (s[1][4] == '1' && (s[1][1] == '1' || s[1][2] == '1' || s[1][3] == '1' ||
                         s[2][1] == '1' || s[3][2] == '1' || s[4][3] == '1')) {
    printf("YES\n");
    return 0;
  }
  if (s[2][4] == '1' && (s[2][1] == '1' || s[2][2] == '1' || s[2][3] == '1' ||
                         s[1][3] == '1' || s[4][2] == '1' || s[3][1] == '1')) {
    printf("YES\n");
    return 0;
  }
  if (s[3][4] == '1' && (s[3][1] == '1' || s[3][2] == '1' || s[3][3] == '1' ||
                         s[1][2] == '1' || s[2][3] == '1' || s[4][1] == '1')) {
    printf("YES\n");
    return 0;
  }
  if (s[4][4] == '1' && (s[4][1] == '1' || s[4][2] == '1' || s[4][3] == '1' ||
                         s[1][1] == '1' || s[2][2] == '1' || s[3][3] == '1')) {
    printf("YES\n");
    return 0;
  }
  printf("NO\n");
  return 0;
}
