#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
string arr[5];
string tmp[5];
bool check(int i, int j) {
  if (j < 3 && tmp[i][j] == 'x' && tmp[i][j + 1] == 'x' && tmp[i][j + 2] == 'x')
    return true;
  if (i < 3 && tmp[i][j] == 'x' && tmp[i + 1][j] == 'x' && tmp[i + 2][j] == 'x')
    return true;
  if (i < 3 && j < 3 && tmp[i][j] == 'x' && tmp[i + 1][j + 1] == 'x' &&
      tmp[i + 2][j + 2] == 'x')
    return true;
  if (i >= 2 && j < 3 && tmp[i][j] == 'x' && tmp[i - 1][j + 1] == 'x' &&
      tmp[i - 2][j + 2] == 'x')
    return true;
  return false;
}
bool valid(int a, int b) {
  for (int i = 0; i < 5; i++) tmp[i] = arr[i];
  if (tmp[a][b] != '.') return false;
  tmp[a][b] = 'x';
  bool ans = false;
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 5; j++) ans |= check(i, j);
  return ans;
}
int main() {
  for (int i = 0; i < 5; i++) cin >> arr[i];
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 5; j++) {
      if (valid(i, j)) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
