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