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