#include <bits/stdc++.h>
using namespace std;
const int N = 40;
const int M = 15005;
const int offset = 7500;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
int T, n, m;
int s[N][N];
int main() {
  int f = 0;
  for (int i = 0; i < 4; i++)
    for (int j = 1; j <= 4; j++) scanf("%d", &s[i][j]);
  for (int i = 0; i < 4; i++) {
    if (f) break;
    if (s[i][4] == 1 && s[i][1] + s[i][2] + s[i][3] >= 1) {
      f = 1;
      break;
    }
    if (s[i][4] == 1) {
      if (s[(i + 1) % 4][1] || s[(i + 2) % 4][2] || s[(i + 3) % 4][3]) {
        f = 1;
        break;
      }
    }
  }
  if (f)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
