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