#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, i2;
  int y = 0;
  int x[5][5];
  for (i = 1; i <= 4; i++) {
    for (i2 = 1; i2 <= 4; i2++) {
      cin >> x[i][i2];
    }
  }
  if (x[1][4] == 1 && (x[1][1] == 1 || x[1][2] == 1 || x[1][3] == 1 ||
                       x[2][1] == 1 || x[3][2] == 1 || x[4][3] == 1)) {
    y++;
  } else if (x[2][4] == 1 && (x[2][1] == 1 || x[2][2] == 1 || x[2][3] == 1 ||
                              x[3][1] == 1 || x[4][2] == 1 || x[1][3] == 1)) {
    y++;
  } else if (x[3][4] == 1 && (x[3][1] == 1 || x[3][2] == 1 || x[3][3] == 1 ||
                              x[4][1] == 1 || x[2][3] == 1 || x[1][2] == 1)) {
    y++;
  } else if (x[4][4] == 1 && (x[4][1] == 1 || x[4][2] == 1 || x[4][3] == 1 ||
                              x[1][1] == 1 || x[2][2] == 1 || x[3][3] == 1)) {
    y++;
  }
  if (y == 0) {
    cout << "NO";
  } else {
    cout << "YES";
  }
  return 0;
}
