#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int map[4][4];
  while (cin >> map[0][0]) {
    for (int i = 0; i < 4; i++)
      for (int j = 0; j < 4; j++) {
        if (j == 0 && i == 0)
          continue;
        else
          cin >> map[i][j];
      }
    int flag = 0;
    for (int i = 0; i < 4; i++) {
      if (map[i][3]) {
        for (int j = 0; j < 3; j++)
          if (map[i][j]) flag = 1;
        if (map[(i + 2) % 4][1]) flag = 1;
        if (map[(i + 1) % 4][0]) flag = 1;
        if (map[(i + 3) % 4][2]) flag = 1;
      }
    }
    if (flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
