#include <bits/stdc++.h>
using namespace std;
int a[100][100];
bool check(int x) {
  if (x == 1) {
    if (a[1][0] == 1 || a[3][2] == 1 || a[2][1] == 1 || a[0][0] == 1 ||
        a[0][1] == 1 || a[0][2] == 1)
      return false;
  } else if (x == 2) {
    if (a[0][2] == 1 || a[2][0] == 1 || a[3][1] == 1 || a[1][0] == 1 ||
        a[1][1] == 1 || a[1][2] == 1)
      return false;
  } else if (x == 3) {
    if (a[1][2] == 1 || a[3][0] == 1 || a[0][1] == 1 || a[2][0] == 1 ||
        a[2][1] == 1 || a[2][2] == 1)
      return false;
  } else if (x == 4) {
    if (a[0][0] == 1 || a[1][1] == 1 || a[2][2] == 1 || a[3][0] == 1 ||
        a[3][1] == 1 || a[3][2] == 1)
      return false;
  }
  return true;
}
int main() {
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      if (j == 3 && a[i][j] == 1) {
        bool x = check((i + 1));
        if (x == 0) {
          cout << "YES";
          return 0;
        }
      }
    }
  }
  cout << "NO";
  return 0;
}
