#include <bits/stdc++.h>
int main() {
  int vis[5] = {0};
  int dir[5][5] = {{4, 3, 2}, {1, 4, 3}, {2, 1, 4}, {3, 2, 1}};
  int viss[5] = {0};
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 3; j++) {
      int a;
      scanf("%d", &a);
      if (a) {
        viss[dir[i][j]] = 1;
        viss[i + 1] = 1;
      }
    }
    int b;
    scanf("%d", &b);
    if (b) vis[i + 1] = 1;
  }
  int f = 0;
  for (int i = 1; i <= 4; i++) {
    if (vis[i] && viss[i]) {
      f = 1;
      break;
    }
  }
  if (f)
    printf("YES\n");
  else
    printf("NO\n");
}
