Ilya is an experienced player in tic-tac-toe on the 4 × 4 field. He always starts and plays with Xs. He played a lot of games today with his friend Arseny. The friends became tired and didn't finish the last game. It was Ilya's turn in the game when they left it. Determine whether Ilya could have won the game by making single turn or not. 

The rules of tic-tac-toe on the 4 × 4 field are as follows. Before the first turn all the field cells are empty. The two players take turns placing their signs into empty cells (the first player places Xs, the second player places Os). The player who places Xs goes first, the another one goes second. The winner is the player who first gets three of his signs in a row next to each other (horizontal, vertical or diagonal).


-----Input-----

The tic-tac-toe position is given in four lines.

Each of these lines contains four characters. Each character is '.' (empty cell), 'x' (lowercase English letter x), or 'o' (lowercase English letter o). It is guaranteed that the position is reachable playing tic-tac-toe, and it is Ilya's turn now (in particular, it means that the game is not finished). It is possible that all the cells are empty, it means that the friends left without making single turn.


-----Output-----

Print single line: "YES" in case Ilya could have won by making single turn, and "NO" otherwise.


-----Examples-----
Input
xx..
.oo.
x...
oox.

Output
YES

Input
x.ox
ox..
x.o.
oo.x

Output
NO

Input
x..x
..oo
o...
x.xo

Output
YES

Input
o.x.
o...
.x..
ooxx

Output
NO



-----Note-----

In the first example Ilya had two winning moves: to the empty cell in the left column and to the leftmost empty cell in the first row.

In the second example it wasn't possible to win by making single turn.

In the third example Ilya could have won by placing X in the last row between two existing Xs.

In the fourth example it wasn't possible to win by making single turn.

Difficulty: EASY

Solutions:
def main():
	a = [input(), input(), input(), input()]
	for i in range(4):
		for j in range(4):
			if a[i][j] == '.':
				if i == 0:
					if j == 0:
						if a[0][1] == 'x' and a[0][2] == 'x' or (a[1][0] == 'x' and a[2][0] == 'x') or (a[1][1] == 'x' and a[2][2] == 'x'):
							print('YES')
							return
					elif j == 1:
						if a[0][0] == 'x' and a[0][2] == 'x' or (a[0][2] == 'x' and a[0][3] == 'x') or (a[1][1] == 'x' and a[2][1] == 'x') or (a[1][2] == 'x' and a[2][3] == 'x'):
							print('YES')
							return
					elif j == 2:
						if a[0][0] == 'x' and a[0][1] == 'x' or (a[0][1] == 'x' and a[0][3] == 'x') or (a[1][2] == 'x' and a[2][2] == 'x') or (a[1][1] == 'x' and a[2][0] == 'x'):
							print('YES')
							return
					elif a[0][1] == 'x' and a[0][2] == 'x' or (a[1][3] == 'x' and a[2][3] == 'x') or (a[1][2] == 'x' and a[2][1] == 'x'):
						print('YES')
						return
				elif i == 1:
					if j == 0:
						if a[0][0] == 'x' and a[2][0] == 'x' or (a[1][1] == 'x' and a[1][2] == 'x') or (a[2][0] == 'x' and a[3][0] == 'x') or (a[2][1] == 'x' and a[3][2] == 'x'):
							print('YES')
							return
					elif j == 1:
						if a[0][0] == 'x' and a[2][2] == 'x' or (a[2][2] == 'x' and a[3][3] == 'x') or (a[0][2] == 'x' and a[2][0] == 'x') or (a[0][1] == 'x' and a[2][1] == 'x') or (a[2][1] == 'x' and a[3][1] == 'x') or (a[1][0] == 'x' and a[1][2] == 'x') or (a[1][2] == 'x' and a[1][3] == 'x'):
							print('YES')
							return
					elif j == 2:
						if a[0][1] == 'x' and a[2][3] == 'x' or (a[2][1] == 'x' and a[3][0] == 'x') or (a[0][3] == 'x' and a[2][1] == 'x') or (a[0][2] == 'x' and a[2][2] == 'x') or (a[2][2] == 'x' and a[3][2] == 'x') or (a[1][0] == 'x' and a[1][1] == 'x') or (a[1][1] == 'x' and a[1][3] == 'x'):
							print('YES')
							return
					elif a[0][3] == 'x' and a[2][3] == 'x' or (a[1][1] == 'x' and a[1][2] == 'x') or (a[2][3] == 'x' and a[3][3] == 'x') or (a[2][2] == 'x' and a[3][1] == 'x'):
						print('YES')
						return
				elif i == 2:
					if j == 0:
						if a[0][0] == 'x' and a[1][0] == 'x' or (a[2][1] == 'x' and a[2][2] == 'x') or (a[1][0] == 'x' and a[3][0] == 'x') or (a[1][1] == 'x' and a[0][2] == 'x'):
							print('YES')
							return
					elif j == 1:
						if a[0][3] == 'x' and a[1][2] == 'x' or (a[1][2] == 'x' and a[3][0] == 'x') or (a[1][0] == 'x' and a[3][2] == 'x') or (a[0][1] == 'x' and a[1][1] == 'x') or (a[1][1] == 'x' and a[3][1] == 'x') or (a[2][0] == 'x' and a[2][2] == 'x') or (a[2][2] == 'x' and a[2][3] == 'x'):
							print('YES')
							return
					elif j == 2:
						if a[0][0] == 'x' and a[1][1] == 'x' or (a[1][1] == 'x' and a[3][3] == 'x') or (a[1][3] == 'x' and a[3][1] == 'x') or (a[0][2] == 'x' and a[1][2] == 'x') or (a[1][2] == 'x' and a[3][2] == 'x') or (a[2][0] == 'x' and a[2][1] == 'x') or (a[2][1] == 'x' and a[2][3] == 'x'):
							print('YES')
							return
					elif a[0][3] == 'x' and a[1][3] == 'x' or (a[2][1] == 'x' and a[2][2] == 'x') or (a[1][3] == 'x' and a[3][3] == 'x') or (a[0][1] == 'x' and a[1][2] == 'x'):
						print('YES')
						return
				elif j == 0:
					if a[3][1] == 'x' and a[3][2] == 'x' or (a[1][0] == 'x' and a[2][0] == 'x') or (a[2][1] == 'x' and a[1][2] == 'x'):
						print('YES')
						return
				elif j == 1:
					if a[3][0] == 'x' and a[3][2] == 'x' or (a[3][2] == 'x' and a[3][3] == 'x') or (a[1][1] == 'x' and a[2][1] == 'x') or (a[2][2] == 'x' and a[1][3] == 'x'):
						print('YES')
						return
				elif j == 2:
					if a[3][0] == 'x' and a[3][1] == 'x' or (a[3][1] == 'x' and a[3][3] == 'x') or (a[1][2] == 'x' and a[2][2] == 'x') or (a[2][1] == 'x' and a[1][0] == 'x'):
						print('YES')
						return
				elif a[3][1] == 'x' and a[3][2] == 'x' or (a[1][3] == 'x' and a[2][3] == 'x') or (a[1][1] == 'x' and a[2][2] == 'x'):
					print('YES')
					return
	print('NO')
main()


def check(matrix, i, j):
	for new_position in [(0, 1), (0, -1), (1, 0), (-1, 0), (-1, -1), (-1, 1), (1, -1), (1, 1)]:
		node_position = (i + new_position[0], j + new_position[1])
		node_position2 = (i + new_position[0] * 2, j + new_position[1] * 2)
		if node_position[0] < 0 or node_position2[0] < 0 or node_position[1] > len(matrix) - 1 or (node_position2[1] > len(matrix) - 1):
			continue
		if node_position[0] > len(matrix) - 1 or node_position2[0] > len(matrix) - 1 or node_position[1] < 0 or (node_position2[1] < 0):
			continue
		if matrix[node_position[0]][node_position[1]] == 'x' and matrix[node_position2[0]][node_position2[1]] == '.':
			return True
		elif matrix[node_position2[0]][node_position2[1]] == 'x' and matrix[node_position[0]][node_position[1]] == '.':
			return True

def tic_tac_move():
	matrix = [input() for i in range(4)]
	for i in range(len(matrix)):
		for j in range(len(matrix[i])):
			if matrix[i][j] == 'x':
				if check(matrix, i, j):
					return 'YES'
	return 'NO'
print(tic_tac_move())


sol = ['x.x', '.xx', 'xx.']
g = []
g1 = []
(s1, s2) = ('', '')
for i in range(4):
	g.append(input())
for i in range(4):
	s = ''
	s1 += g[i][i]
	s2 += g[i][4 - i - 1]
	for j in g:
		s += j[i]
	g1.append(s)
g1.append(s1)
g1.append(s2)
s = ''
for i in range(3):
	s += g[i][i + 1]
g1.append(s)
s = ''
for i in range(3):
	s += g[i + 1][i]
g1.append(s)
s = ''
for i in range(3):
	s += g[i][3 - 1 - i]
g1.append(s)
s = ''
for i in range(3):
	s += g[i + 1][4 - 1 - i]
g1.append(s)
g += g1
for i in g:
	for j in sol:
		if i.count(j):
			print('YES')
			exit()
print('NO')


from sys import stdin, stdout
sze = 4
maps = []
for i in range(sze):
	maps.append(list(stdin.readline().strip()))

def check(maps):
	for i in range(sze - 2):
		for j in range(sze):
			if maps[i][j] == maps[i + 1][j] == maps[i + 2][j] == 'x':
				return True
	for i in range(sze):
		for j in range(sze - 2):
			if maps[i][j] == maps[i][j + 1] == maps[i][j + 2] == 'x':
				return True
	for i in range(sze - 2):
		for j in range(sze - 2):
			if maps[i][j] == maps[i + 1][j + 1] == maps[i + 2][j + 2] == 'x':
				return True
	for i in range(sze - 2, sze):
		for j in range(sze - 2):
			if maps[i][j] == maps[i - 1][j + 1] == maps[i - 2][j + 2] == 'x':
				return True
	return False
label = 0
for i in range(sze):
	for j in range(sze):
		if maps[i][j] == '.':
			maps[i][j] = 'x'
			if check(maps):
				label = 1
			maps[i][j] = '.'
if label:
	stdout.write('YES')
else:
	stdout.write('NO')


import re

def ri():
	return map(int, input().split())
p1 = re.compile('xx\\.')
p2 = re.compile('x\\.x')
p3 = re.compile('\\.xx')
s = [[] for i in range(4)]
for i in range(4):
	s[i] = input()
	if p1.search(s[i]) != None:
		print('YES')
		exit()
	if p2.search(s[i]) != None:
		print('YES')
		exit()
	if p3.search(s[i]) != None:
		print('YES')
		exit()
s2 = [[] for i in range(4)]
for i in range(4):
	for j in range(4):
		s2[i].append(s[j][i])
for i in range(4):
	s2[i] = ''.join(s2[i])
	if p1.search(s2[i]) != None:
		print('YES')
		exit()
	if p2.search(s2[i]) != None:
		print('YES')
		exit()
	if p3.search(s2[i]) != None:
		print('YES')
		exit()
s2 = [[] for i in range(3)]
s2[0].append(s[1][0])
s2[0].append(s[2][1])
s2[0].append(s[3][2])
s2[1].append(s[0][0])
s2[1].append(s[1][1])
s2[1].append(s[2][2])
s2[1].append(s[3][3])
s2[2].append(s[0][1])
s2[2].append(s[1][2])
s2[2].append(s[2][3])
for i in range(3):
	s2[i] = ''.join(s2[i])
	if p1.search(s2[i]) != None:
		print('YES')
		exit()
	if p2.search(s2[i]) != None:
		print('YES')
		exit()
	if p3.search(s2[i]) != None:
		print('YES')
		exit()
s2 = [[] for i in range(3)]
s2[0].append(s[1][3])
s2[0].append(s[2][2])
s2[0].append(s[3][1])
s2[1].append(s[0][3])
s2[1].append(s[1][2])
s2[1].append(s[2][1])
s2[1].append(s[3][0])
s2[2].append(s[0][2])
s2[2].append(s[1][1])
s2[2].append(s[2][0])
for i in range(3):
	s2[i] = ''.join(s2[i])
	if p1.search(s2[i]) != None:
		print('YES')
		exit()
	if p2.search(s2[i]) != None:
		print('YES')
		exit()
	if p3.search(s2[i]) != None:
		print('YES')
		exit()
print('NO')


l = []
ans = 0
for i in range(4):
	x = input()
	if 'xx.' in x or '.xx' in x or 'x.x' in x:
		ans = 1
	l.append(x)
for i in range(2):
	for j in range(4):
		tate = l[i][j] + l[i + 1][j] + l[i + 2][j]
		if 'xx.' in tate or '.xx' in tate or 'x.x' in tate:
			ans = 1
		if j >= 2:
			y = l[i][j] + l[i + 1][j - 1] + l[i + 2][j - 2]
			if 'xx.' in y or '.xx' in y or 'x.x' in y:
				ans = 1
		if j < 2:
			y = l[i][j] + l[i + 1][j + 1] + l[i + 2][j + 2]
			if 'xx.' in y or '.xx' in y or 'x.x' in y:
				ans = 1
print('YES' if ans else 'NO')


mas = []
for i in range(4):
	q = input()
	mas.append([])
	for (j, x) in enumerate(q):
		mas[i].append(x)
from sys import exit
for i in range(4):
	for j in range(1, 3):
		(a, b, c) = (mas[i][j], mas[i][j - 1], mas[i][j + 1])
		if a == '.' and b == 'x' and (c == 'x'):
			print('YES')
			exit()
		if a == 'x' and b == '.' and (c == 'x'):
			print('YES')
			exit()
		if a == 'x' and b == 'x' and (c == '.'):
			print('YES')
			exit()
for i in range(1, 3):
	for j in range(4):
		(a, b, c) = (mas[i][j], mas[i - 1][j], mas[i + 1][j])
		if a == '.' and b == 'x' and (c == 'x'):
			print('YES')
			exit()
		if a == 'x' and b == '.' and (c == 'x'):
			print('YES')
			exit()
		if a == 'x' and b == 'x' and (c == '.'):
			print('YES')
			exit()
for i in range(1, 3):
	for j in range(1, 3):
		(a, b, c) = (mas[i][j], mas[i - 1][j + 1], mas[i + 1][j - 1])
		if a == '.' and b == 'x' and (c == 'x'):
			print('YES')
			exit()
		if a == 'x' and b == '.' and (c == 'x'):
			print('YES')
			exit()
		if a == 'x' and b == 'x' and (c == '.'):
			print('YES')
			exit()
		(b, c) = (mas[i - 1][j - 1], mas[i + 1][j + 1])
		if a == '.' and b == 'x' and (c == 'x'):
			print('YES')
			exit()
		if a == 'x' and b == '.' and (c == 'x'):
			print('YES')
			exit()
		if a == 'x' and b == 'x' and (c == '.'):
			print('YES')
			exit()
print('NO')


def myc(a, b, c, d, e, f):
	return str(iph[a][b] + iph[c][d] + iph[e][f])
iph = []
for i in range(4):
	iph.append(str(input()))
ipv = []
b = 0
for i in range(4):
	ipv.append(str(iph[0][i] + iph[1][i] + iph[2][i] + iph[3][i]))
for i in iph:
	if 'x.x' in i or 'xx.' in i or '.xx' in i:
		b = 1
	if 'ooo' in i:
		b = 2
		break
if b != 2:
	for i in ipv:
		if 'x.x' in i or 'xx.' in i or '.xx' in i:
			b = 1
		if 'ooo' in i:
			b = 2
			break
if b != 2:
	ipd = [myc(0, 0, 1, 1, 2, 2), myc(1, 1, 2, 2, 3, 3), myc(1, 0, 2, 1, 3, 2), myc(0, 1, 1, 2, 2, 3), myc(0, 2, 1, 1, 2, 0), myc(0, 3, 1, 2, 2, 1), myc(1, 2, 2, 1, 3, 0), myc(1, 3, 2, 2, 3, 1)]
	for i in ipd:
		if 'x.x' in i or 'xx.' in i or ('.xx' in i and b == 0):
			b = 1
		if 'ooo' in i:
			b = 2
			break
if b == 0 or b == 2:
	print('NO')
else:
	print('YES')


dx = [1, 1, 1, 0, 0, -1, -1, -1]
dy = [1, 0, -1, 1, -1, 1, 0, -1]
ddx = [2, 2, 2, 0, 0, -2, -2, -2]
ddy = [2, 0, -2, 2, -2, 2, 0, -2]
mapn = []

def check(hex, i, j):
	for k in range(8):
		if i + dx[k] >= 0 and i + dx[k] < 4 and (j + dy[k] >= 0) and (j + dy[k] < 4):
			if mapn[i + dx[k]][j + dy[k]] == hex:
				if i + 2 * dx[k] >= 0 and i + 2 * dx[k] < 4 and (j + 2 * dy[k] >= 0) and (j + 2 * dy[k] < 4):
					if mapn[i + 2 * dx[k]][j + 2 * dy[k]] == '.':
						return True
					else:
						continue
			else:
				continue
	for k in range(8):
		if i + ddx[k] >= 0 and i + ddx[k] < 4 and (j + ddy[k] >= 0) and (j + ddy[k] < 4):
			if mapn[i + ddx[k]][j + ddy[k]] == hex:
				if mapn[i + dx[k]][j + dy[k]] == '.':
					return True
				else:
					continue
			else:
				continue
	return False

def main():
	for i in range(4):
		mapn.append(input())
	num_x = 0
	num_o = 0
	for i in range(4):
		for j in range(4):
			if mapn[i][j] == 'x':
				num_x = num_x + 1
			elif mapn[i][j] == 'o':
				num_o = num_o + 1
			else:
				continue
	flag = 0
	if num_x <= num_o:
		for i in range(4):
			for j in range(4):
				if mapn[i][j] == 'x':
					if check('x', i, j):
						flag = 1
	else:
		for i in range(4):
			for j in range(4):
				if mapn[i][j] == 'o':
					if check('o', i, j):
						flag = 1
	if flag:
		print('YES')
	else:
		print('NO')
main()


import sys

def finder(arr):
	if any(map(lambda x: x.find('.xx') > -1 or x.find('xx.') > -1 or x.find('x.x') > -1, arr)):
		print('YES')
		sys.exit()
field = [input() for _ in range(4)]
finder(field)
transposed = list(map(lambda x: ''.join(x), zip(*field[::-1])))
finder(transposed)

def diags(arr):
	for y_of in range(2):
		for x_of in range(2):
			yield ''.join([arr[y_of + i][x_of + i] for i in range(3)])
			yield ''.join([arr[3 - (y_of + i)][x_of + i] for i in range(3)])
finder(list(diags(field)))
print('NO')


mat = []
for i in range(4):
	l = list(map(str, input()))
	mat.append(l)
diag1 = mat[0][0] + mat[1][1] + mat[2][2]
diag2 = mat[1][0] + mat[2][1] + mat[3][2]
diag3 = mat[0][1] + mat[1][2] + mat[2][3]
diag4 = mat[0][2] + mat[1][1] + mat[2][0]
diag4 = mat[0][3] + mat[1][2] + mat[2][1]
diag5 = mat[1][3] + mat[2][2] + mat[3][1]
diag6 = mat[3][0] + mat[2][1] + mat[1][2]
diag7 = mat[3][1] + mat[2][2] + mat[1][3]
diag8 = mat[1][3] + mat[2][2] + mat[3][1]
diag9 = mat[2][0] + mat[1][1] + mat[0][2]
diag10 = mat[3][3] + mat[2][2] + mat[1][1]
diag11 = mat[2][3] + mat[1][2] + mat[0][1]
diag12 = mat[3][2] + mat[2][1] + mat[1][0]
l = [diag1, diag2, diag3, diag4, diag5, diag6, diag7, diag8, diag9, diag10, diag11, diag12]
if 'x.x' in l or 'xx.' in l or '.xx' in l:
	print('YES')
else:
	for i in range(4):
		for j in range(2):
			row = mat[i][j] + mat[i][j + 1] + mat[i][j + 2]
			if row == 'x.x' or row == 'xx.' or row == '.xx':
				print('YES')
				exit()
	for i in range(4):
		for j in range(2):
			row = mat[j][i] + mat[j + 1][i] + mat[j + 2][i]
			if row == 'x.x' or row == 'xx.' or row == '.xx':
				print('YES')
				exit()
	print('NO')
	exit()


def check(l):
	for i in l:
		if 'xxx' in ''.join(i):
			return True
	for i in zip(*l):
		if 'xxx' in ''.join(i):
			return True
	if 'xxx' in ''.join([l[i][i + 1] for i in range(3)]):
		return True
	if 'xxx' in ''.join([l[i + 1][i] for i in range(3)]):
		return True
	if 'xxx' in ''.join([l[i][i] for i in range(4)]):
		return True
	if 'xxx' in ''.join([l[i][3 - i] for i in range(4)]):
		return True
	if 'xxx' in ''.join([l[2 - i][i] for i in range(3)]):
		return True
	if 'xxx' in ''.join([l[4 - i][i] for i in range(1, 4)]):
		return True
	return False

def main():
	l = [list(input()) for _ in range(4)]
	for i in range(4):
		for j in range(4):
			if l[i][j] != '.':
				continue
			l[i][j] = 'x'
			if check(l):
				print('YES')
				return
			l[i][j] = '.'
	print('NO')
main()


import sys
matrix = []
for i in range(4):
	s = input()
	l = []
	for j in range(4):
		l.append(s[j])
	matrix.append(l)
ans = 'NO'
for i in range(4):
	for j in range(4):
		if matrix[i][j] == 'x':
			if i < 2:
				if matrix[i + 1][j] == 'x' and matrix[i + 2][j] == '.':
					ans = 'YES'
					print(ans)
					sys.exit()
				if matrix[i + 1][j] == '.' and matrix[i + 2][j] == 'x':
					ans = 'YES'
					print(ans)
					sys.exit()
			else:
				if matrix[i - 1][j] == 'x' and matrix[i - 2][j] == '.':
					ans = 'YES'
					print(ans)
					sys.exit()
				if matrix[i - 1][j] == '.' and matrix[i - 2][j] == 'x':
					ans = 'YES'
					print(ans)
					sys.exit()
			if j < 2:
				if matrix[i][j + 1] == 'x' and matrix[i][j + 2] == '.':
					ans = 'YES'
					print(ans)
					sys.exit()
				if matrix[i][j + 1] == '.' and matrix[i][j + 2] == 'x':
					ans = 'YES'
					print(ans)
					sys.exit()
			else:
				if matrix[i][j - 1] == 'x' and matrix[i][j - 2] == '.':
					ans = 'YES'
					print(ans)
					sys.exit()
				if matrix[i][j - 1] == '.' and matrix[i][j - 2] == 'x':
					ans = 'YES'
					print(ans)
					sys.exit()
			if i < 2 and j < 2:
				if matrix[i + 1][j + 1] == 'x' and matrix[i + 2][j + 2] == '.':
					ans = 'YES'
					print(ans)
					sys.exit()
				if matrix[i + 1][j + 1] == '.' and matrix[i + 2][j + 2] == 'x':
					ans = 'YES'
					print(ans)
					sys.exit()
			elif i >= 2 and j >= 2:
				if matrix[i - 1][j - 1] == 'x' and matrix[i - 2][j - 2] == '.':
					ans = 'YES'
					print(ans)
					sys.exit()
				if matrix[i - 1][j - 1] == '.' and matrix[i - 2][j - 2] == 'x':
					ans = 'YES'
					print(ans)
					sys.exit()
			if i < 2 and j >= 2:
				if matrix[i + 1][j - 1] == 'x' and matrix[i + 2][j - 2] == '.':
					ans = 'YES'
					print(ans)
					sys.exit()
				if matrix[i + 1][j - 1] == '.' and matrix[i + 2][j - 2] == 'x':
					ans = 'YES'
					print(ans)
					sys.exit()
			if i >= 2 and j < 2:
				if matrix[i - 1][j + 1] == 'x' and matrix[i - 2][j + 2] == '.':
					ans = 'YES'
					print(ans)
					sys.exit()
				if matrix[i - 1][j + 1] == '.' and matrix[i - 2][j + 2] == 'x':
					ans = 'YES'
					print(ans)
					sys.exit()
print(ans)


def checkWin(game):
	for i in range(0, 4):
		if ''.join(game[i]).find('xxx') >= 0:
			return True
	for i in range(0, 4):
		x = game[0][i] + game[1][i] + game[2][i] + game[3][i]
		if x.find('xxx') >= 0:
			return True
	for i in [0, 1]:
		for j in [0, 1]:
			x = game[i][j] + game[i + 1][j + 1] + game[i + 2][j + 2]
			if x.find('xxx') >= 0:
				return True
	for i in [0, 1]:
		for j in [3, 2]:
			x = game[i][j] + game[i + 1][j - 1] + game[i + 2][j - 2]
			if x.find('xxx') >= 0:
				return True
	return False

def executeProgram(game):
	for i in range(0, 4):
		for j in range(0, 4):
			if game[i][j] == '.':
				game[i][j] = 'x'
				if checkWin(game):
					return 'YES'
				game[i][j] = '.'
	return 'NO'
game = [list(input()), list(input()), list(input()), list(input())]
ans = executeProgram(game)
print(ans)


import sys
from copy import deepcopy

def passer(n, m):
	for i in range(n):
		for j in range(m):
			yield (i, j)

def is_won(data):
	mat = [[1 if j == 'x' else 0 for j in i] for i in data]
	tmat = deepcopy(mat)
	for (i, j) in passer(4, 4):
		if j != 0 and tmat[i][j] == 1 and (tmat[i][j - 1] != 0):
			tmat[i][j] += tmat[i][j - 1]
		if tmat[i][j] == 3:
			return True
	tmat = deepcopy(mat)
	for (i, j) in passer(4, 4):
		if i != 0 and tmat[i][j] == 1 and (tmat[i - 1][j] != 0):
			tmat[i][j] += tmat[i - 1][j]
		if tmat[i][j] == 3:
			return True
	tmat = deepcopy(mat)
	for (i, j) in passer(4, 4):
		if i != 0 and j != 0 and (tmat[i][j] == 1) and (tmat[i - 1][j - 1] != 0):
			tmat[i][j] += tmat[i - 1][j - 1]
		if tmat[i][j] == 3:
			return True
	tmat = deepcopy(mat)
	for (i, j) in passer(4, 4):
		if i != 0 and j != 3 and (tmat[i][j] == 1) and (tmat[i - 1][j + 1] != 0):
			tmat[i][j] += tmat[i - 1][j + 1]
		if tmat[i][j] == 3:
			return True
input_data = []
for i in range(4):
	input_data.append(input().rstrip())
for (i, j) in passer(4, 4):
	if is_won(input_data):
		print('YES')
		break
	if input_data[i][j] == '.':
		copy_data = input_data.copy()
		copy_data[i] = copy_data[i][:j] + 'x' + copy_data[i][j + 1:]
		if is_won(copy_data):
			print('YES')
			break
else:
	print('NO')


mat = []
for i in range(4):
	mat.append(list(input()))
ok = False
for i in range(4):
	if mat[i][0] == 'x' and mat[i][1] == 'x' and (mat[i][2] == '.'):
		ok = True
	elif mat[i][0] == 'x' and mat[i][1] == '.' and (mat[i][2] == 'x'):
		ok = True
	elif mat[i][0] == '.' and mat[i][1] == 'x' and (mat[i][2] == 'x'):
		ok = True
	if mat[i][3] == 'x' and mat[i][1] == 'x' and (mat[i][2] == '.'):
		ok = True
	elif mat[i][3] == 'x' and mat[i][1] == '.' and (mat[i][2] == 'x'):
		ok = True
	elif mat[i][3] == '.' and mat[i][1] == 'x' and (mat[i][2] == 'x'):
		ok = True
for i in range(4):
	if mat[0][i] == 'x' and mat[1][i] == 'x' and (mat[2][i] == '.'):
		ok = True
	elif mat[0][i] == 'x' and mat[1][i] == '.' and (mat[2][i] == 'x'):
		ok = True
	elif mat[0][i] == '.' and mat[1][i] == 'x' and (mat[2][i] == 'x'):
		ok = True
	if mat[3][i] == 'x' and mat[1][i] == 'x' and (mat[2][i] == '.'):
		ok = True
	elif mat[3][i] == 'x' and mat[1][i] == '.' and (mat[2][i] == 'x'):
		ok = True
	elif mat[3][i] == '.' and mat[1][i] == 'x' and (mat[2][i] == 'x'):
		ok = True
if mat[0][0] == 'x' and mat[1][1] == 'x' and (mat[2][2] == '.'):
	ok = True
elif mat[0][0] == 'x' and mat[1][1] == '.' and (mat[2][2] == 'x'):
	ok = True
elif mat[0][0] == '.' and mat[1][1] == 'x' and (mat[2][2] == 'x'):
	ok = True
if mat[0][1] == 'x' and mat[1][2] == 'x' and (mat[2][3] == '.'):
	ok = True
elif mat[0][1] == 'x' and mat[1][2] == '.' and (mat[2][3] == 'x'):
	ok = True
elif mat[0][1] == '.' and mat[1][2] == 'x' and (mat[2][3] == 'x'):
	ok = True
if mat[0][2] == 'x' and mat[1][1] == 'x' and (mat[2][0] == '.'):
	ok = True
elif mat[0][2] == 'x' and mat[1][1] == '.' and (mat[2][0] == 'x'):
	ok = True
elif mat[0][2] == '.' and mat[1][1] == 'x' and (mat[2][0] == 'x'):
	ok = True
if mat[0][3] == 'x' and mat[1][2] == 'x' and (mat[2][1] == '.'):
	ok = True
elif mat[0][3] == 'x' and mat[1][2] == '.' and (mat[2][1] == 'x'):
	ok = True
elif mat[0][3] == '.' and mat[1][2] == 'x' and (mat[2][1] == 'x'):
	ok = True
if mat[1][0] == 'x' and mat[2][1] == 'x' and (mat[3][2] == '.'):
	ok = True
elif mat[1][0] == 'x' and mat[2][1] == '.' and (mat[3][2] == 'x'):
	ok = True
elif mat[1][0] == '.' and mat[2][1] == 'x' and (mat[3][2] == 'x'):
	ok = True
if mat[1][1] == 'x' and mat[2][2] == 'x' and (mat[3][3] == '.'):
	ok = True
elif mat[1][1] == 'x' and mat[2][2] == '.' and (mat[3][3] == 'x'):
	ok = True
elif mat[1][1] == '.' and mat[2][2] == 'x' and (mat[3][3] == 'x'):
	ok = True
if mat[1][2] == 'x' and mat[2][1] == 'x' and (mat[3][0] == '.'):
	ok = True
elif mat[1][2] == 'x' and mat[2][1] == '.' and (mat[3][0] == 'x'):
	ok = True
elif mat[1][2] == '.' and mat[2][1] == 'x' and (mat[3][0] == 'x'):
	ok = True
if mat[1][3] == 'x' and mat[2][2] == 'x' and (mat[3][1] == '.'):
	ok = True
elif mat[1][3] == 'x' and mat[2][2] == '.' and (mat[3][1] == 'x'):
	ok = True
elif mat[1][3] == '.' and mat[2][2] == 'x' and (mat[3][1] == 'x'):
	ok = True
if ok == True:
	print('YES')
else:
	print('NO')


def v_mid(a, i, j):
	return a[i - 1][j] == a[i][j] == a[i + 1][j] == 'x'

def h_mid(a, i, j):
	return a[i][j - 1] == a[i][j] == a[i][j + 1] == 'x'

def upper(a, i, j):
	return a[i - 2][j] == a[i - 1][j] == a[i][j] == 'x'

def lower(a, i, j):
	return a[i + 2][j] == a[i + 1][j] == a[i][j] == 'x'

def left(a, i, j):
	return a[i][j - 2] == a[i][j - 1] == a[i][j] == 'x'

def right(a, i, j):
	return a[i][j + 2] == a[i][j + 1] == a[i][j] == 'x'

def l_diag(a, i, j):
	return a[i + 1][j - 1] == a[i][j] == a[i - 1][j + 1] == 'x'

def r_diag(a, i, j):
	return a[i + 1][j + 1] == a[i][j] == a[i - 1][j - 1] == 'x'

def u_l_diag(a, i, j):
	return a[i - 2][j - 2] == a[i - 1][j - 1] == a[i][j] == 'x'

def u_r_diag(a, i, j):
	return a[i - 2][j + 2] == a[i - 1][j + 1] == a[i][j] == 'x'

def d_r_diag(a, i, j):
	return a[i + 2][j + 2] == a[i + 1][j + 1] == a[i][j] == 'x'

def d_l_diag(a, i, j):
	return a[i + 2][j - 2] == a[i + 1][j - 1] == a[i][j] == 'x'
a = []
a.append(['.'] * 8)
a.append(['.'] * 8)
for i in range(4):
	s = list(input())
	t = ['.', '.'] + s + ['.', '.']
	a.append(t)
a.append(['.'] * 8)
a.append(['.'] * 8)
for i in range(2, 6):
	for j in range(2, 6):
		if a[i][j] == '.':
			a[i][j] = 'x'
			if v_mid(a, i, j) or h_mid(a, i, j) or upper(a, i, j) or lower(a, i, j) or left(a, i, j) or right(a, i, j) or l_diag(a, i, j) or r_diag(a, i, j) or u_l_diag(a, i, j) or u_r_diag(a, i, j) or d_r_diag(a, i, j) or d_l_diag(a, i, j):
				print('YES')
				exit()
			a[i][j] = '.'
print('NO')


M = [['o', 'o', 'o', 'o', 'o', 'o', 'o', 'o'] for i in range(8)]
M1 = [input() for i in range(4)]
c = 'NO'
for i in range(4):
	for j in range(4):
		M[i + 2][j + 2] = M1[i][j]
for i in range(2, 6):
	for j in range(2, 6):
		if M[i][j] == 'x':
			if M[i + 1][j] == 'x' and M[i + 2][j] == 'x' or (M[i + 1][j] == '.' and M[i + 2][j] == 'x') or (M[i + 1][j] == 'x' and M[i + 2][j] == '.'):
				c = 'YES'
			if M[i - 1][j] == 'x' and M[i - 2][j] == 'x' or (M[i - 1][j] == '.' and M[i - 2][j] == 'x') or (M[i - 1][j] == 'x' and M[i - 2][j] == '.'):
				c = 'YES'
			if M[i][j + 1] == 'x' and M[i][j + 2] == 'x' or (M[i][j + 1] == '.' and M[i][j + 2] == 'x') or (M[i][j + 1] == 'x' and M[i][j + 2] == '.'):
				c = 'YES'
			if M[i][j - 1] == 'x' and M[i][j - 2] == 'x' or (M[i][j - 1] == '.' and M[i][j - 2] == 'x') or (M[i][j - 1] == 'x' and M[i][j - 2] == '.'):
				c = 'YES'
			if M[i + 1][j + 1] == 'x' and M[i + 2][j + 2] == 'x' or (M[i + 1][j + 1] == '.' and M[i + 2][j + 2] == 'x') or (M[i + 1][j + 1] == 'x' and M[i + 2][j + 2] == '.'):
				c = 'YES'
			if M[i - 1][j - 1] == 'x' and M[i - 2][j - 2] == 'x' or (M[i - 1][j - 1] == '.' and M[i - 2][j - 2] == 'x') or (M[i - 1][j - 1] == 'x' and M[i - 2][j - 2] == '.'):
				c = 'YES'
			if M[i + 1][j - 1] == 'x' and M[i + 2][j - 2] == 'x' or (M[i + 1][j - 1] == '.' and M[i + 2][j - 2] == 'x') or (M[i + 1][j - 1] == 'x' and M[i + 2][j - 2] == '.'):
				c = 'YES'
			if M[i - 1][j + 1] == 'x' and M[i - 2][j + 2] == 'x' or (M[i - 1][j + 1] == '.' and M[i - 2][j + 2] == 'x') or (M[i - 1][j + 1] == 'x' and M[i - 2][j + 2] == '.'):
				c = 'YES'
print(c)


s = [''] * 4
r = 'NO'
vars = ['xx.', 'x.x', '.xx']
for i in range(4):
	s[i] = input()
	if s[i][:3] in vars or s[i][1:] in vars:
		r = 'YES'
	if i > 1:
		for j in range(4):
			if s[i - 2][j] + s[i - 1][j] + s[i][j] in vars:
				r = 'YES'
for i in range(1, 3):
	for j in range(1, 3):
		if s[i - 1][j - 1] + s[i][j] + s[i + 1][j + 1] in vars or s[i - 1][j + 1] + s[i][j] + s[i + 1][j - 1] in vars:
			r = 'YES'
print(r)


map = [input() for k in range(4)]

def checkVictory(map):
	for x in range(4):
		for y in range(2):
			if map[x][y:y + 3] == 'xxx':
				return True
	for x in range(2):
		for y in range(4):
			if map[x][y] == 'x' and map[x + 1][y] == 'x' and (map[x + 2][y] == 'x'):
				return True
	for x in range(2, 4):
		for y in range(2):
			if map[x][y] == 'x' and map[x - 1][y + 1] == 'x' and (map[x - 2][y + 2] == 'x'):
				return True
	for x in range(2):
		for y in range(2):
			if map[x][y] == 'x' and map[x + 1][y + 1] == 'x' and (map[x + 2][y + 2] == 'x'):
				return True
	return False
import sys
for x in range(4):
	for y in range(4):
		if map[x][y] == '.':
			change = map.copy()
			change[x] = change[x][:y] + 'x' + change[x][y + 1:]
			if checkVictory(change) == True:
				print('YES')
				sys.exit()
print('NO')


S = [list(input()) for i in range(4)]

def check(i, j):
	if i + 2 < 4 and S[i][j] == 'x' and (S[i + 1][j] == 'x') and (S[i + 2][j] == 'x'):
		return True
	if j + 2 < 4 and S[i][j] == 'x' and (S[i][j + 1] == 'x') and (S[i][j + 2] == 'x'):
		return True
	if i + 2 < 4 and j + 2 < 4 and (S[i][j] == 'x') and (S[i + 1][j + 1] == 'x') and (S[i + 2][j + 2] == 'x'):
		return True
	if i + 2 < 4 and j - 2 >= 0 and (S[i][j] == 'x') and (S[i + 1][j - 1] == 'x') and (S[i + 2][j - 2] == 'x'):
		return True
	return False

def solve():
	for i in range(4):
		for j in range(4):
			if S[i][j] == '.':
				S[i][j] = 'x'
				for x in range(4):
					for y in range(4):
						if check(x, y):
							return True
				S[i][j] = '.'
	return False
print('YES' if solve() else 'NO')


l1 = input()
l2 = input()
l3 = input()
l4 = input()
grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
cross = 0
dots = []
for i in range(0, 4):
	if l1[i] == '.':
		dots += [[0 + 2, i + 2]]
	elif l1[i] == 'x':
		cross += 1
		grid[0 + 2][i + 2] = 1
	if l2[i] == '.':
		dots += [[1 + 2, i + 2]]
	elif l2[i] == 'x':
		cross += 1
		grid[1 + 2][i + 2] = 1
	if l3[i] == '.':
		dots += [[2 + 2, i + 2]]
	elif l3[i] == 'x':
		cross += 1
		grid[2 + 2][i + 2] = 1
	if l4[i] == '.':
		dots += [[3 + 2, i + 2]]
	elif l4[i] == 'x':
		cross += 1
		grid[3 + 2][i + 2] = 1

def check(dot, dir, delta):
	nonlocal grid
	grid[dot[0]][dot[1]] = 1
	acc = 1
	if dir == 0:
		for i in range(delta, delta + 3):
			acc *= grid[dot[0] + i][dot[1]]
	elif dir == 1:
		for i in range(delta, delta + 3):
			acc *= grid[dot[0]][dot[1] + i]
	elif dir == 2:
		for i in range(delta, delta + 3):
			acc *= grid[dot[0] + i][dot[1] + i]
	elif dir == 3:
		for i in range(delta, delta + 3):
			acc *= grid[dot[0] + i][dot[1] - i]
	grid[dot[0]][dot[1]] = 0
	return acc
if cross < 2 or len(dots) == 0:
	print('NO')
else:
	for dot in dots:
		for dir in range(0, 4):
			for delta in range(-2, 1):
				if check(dot, dir, delta) == 1:
					print('YES')
					return
print('NO')


import sys
m = [list(input()) for _ in range(4)]

def trans(m):
	return [[m[0][0], m[1][0], m[2][0], m[3][0]], [m[0][1], m[1][1], m[2][1], m[3][1]], [m[0][2], m[1][2], m[2][2], m[3][2]], [m[0][3], m[1][3], m[2][3], m[3][3]]]

def check(m):
	res = any(('xxx' in ''.join(x) for x in m))
	res |= any(('xxx' in ''.join(x) for x in trans(m)))
	for i in range(1, 3):
		for j in range(1, 3):
			res |= m[i - 1][j - 1] + m[i][j] + m[i + 1][j + 1] == 'xxx'
			res |= m[i - 1][j + 1] + m[i][j] + m[i + 1][j - 1] == 'xxx'
	return res
for i in range(4):
	for j in range(4):
		if m[i][j] == '.':
			m[i][j] = 'x'
			if check(m):
				print('YES')
				return
			m[i][j] = '.'
print('NO')


import sys
field = [input() for i in range(4)]

def canWin(f):
	result = False
	for row in f:
		if row.find('xxx') != -1:
			result = True
	transposed_f = ['????' for i in range(4)]
	for i in range(4):
		for j in range(4):
			if transposed_f[i][j] == '?':
				transposed_f[i] = transposed_f[i][:j] + f[j][i] + transposed_f[i][j + 1:]
	for row in transposed_f:
		if row.find('xxx') != -1:
			result = True
	for i in range(2):
		for j in range(2):
			if f[i][j] == 'x' and f[i + 1][j + 1] == 'x' and (f[i + 2][j + 2] == 'x'):
				result = True
	for i in range(2):
		for j in range(3, 1, -1):
			if f[i][j] == 'x' and f[i + 1][j - 1] == 'x' and (f[i + 2][j - 2] == 'x'):
				result = True
	return result
for i in range(4):
	for j in range(4):
		if field[i][j] == '.':
			field[i] = field[i][:j] + 'x' + field[i][j + 1:]
			if canWin(field):
				print('YES')
				sys.exit(0)
			field[i] = field[i][:j] + '.' + field[i][j + 1:]
print('NO')


def checkwin(row, column, board):
	rxdisp = 0
	rxdot = 0
	for r in range(3):
		if row + r >= 4:
			break
		elif board[row + r][column] == 'x':
			rxdisp += 1
		elif board[row + r][column] == '.':
			rxdot += 1
	else:
		if rxdisp >= 2 and rxdot >= 1 or rxdisp >= 3:
			return True
	cxdisp = 0
	cxdot = 0
	for c in range(3):
		if column + c >= 4:
			break
		elif board[row][c + column] == 'x':
			cxdisp += 1
		elif board[row][c + column] == '.':
			cxdot += 1
	else:
		if cxdisp >= 2 and cxdot >= 1 or rxdisp >= 3:
			return True
	crxdisp = 0
	crxdot = 0
	for rc in range(3):
		if column + rc >= 4 or row + rc >= 4:
			break
		elif board[row + rc][column + rc] == 'x':
			crxdisp += 1
		elif board[row + rc][column + rc] == '.':
			crxdot += 1
	else:
		if crxdisp >= 2 and crxdot >= 1 or rxdisp >= 3:
			return True
	crydisp = 0
	crydot = 0
	for rc in range(3):
		if column - rc < 0 or row + rc >= 4:
			break
		elif board[row + rc][column - rc] == 'x':
			crydisp += 1
		elif board[row + rc][column - rc] == '.':
			crydot += 1
	else:
		if crydisp >= 2 and crydot >= 1 or rxdisp >= 3:
			return True
board = []
for n in range(4):
	board.append(input())
flag = 0
for row in range(4):
	if flag:
		break
	for column in range(4):
		if checkwin(row, column, board):
			print('YES')
			flag = 1
			break
else:
	if flag != 1:
		print('NO')


(g, s) = ([input() for i in range(4)], set())
for i in range(4):
	s.add(g[i][:3])
	s.add(g[i][1:])
	s.add(g[0][i] + g[1][i] + g[2][i])
	s.add(g[1][i] + g[2][i] + g[3][i])
for i in range(2):
	for j in range(2):
		s.add(g[i][j] + g[i + 1][j + 1] + g[i + 2][j + 2])
		s.add(g[i][j + 2] + g[i + 1][j + 1] + g[i + 2][j])
print('YES' if {'xx.', 'x.x', '.xx'} & s else 'NO')


L = []
for i in range(0, 4):
	L.append(input())
horizontal = True
vertical = True
diagonal = True
O = []
for i in L:
	O.append(i[:-1])
	O.append(i[1:])
for i in range(0, 4):
	for j in range(0, 2):
		w = L[j][i] + L[j + 1][i] + L[j + 2][i]
		O.append(w)
for i in range(0, 2):
	for j in range(0, 2):
		w = L[j][i] + L[j + 1][i + 1] + L[j + 2][i + 2]
		O.append(w)
for i in range(2, 4):
	for j in range(0, 2):
		w = L[j][i] + L[j + 1][i - 1] + L[j + 2][i - 2]
		O.append(w)
check = False
Valid = ['x.x', 'xx.', '.xx']
for i in Valid:
	if i in O:
		check = True
if check:
	print('YES')
else:
	print('NO')


s = [[] for i in range(4)]
s[0] = [i for i in input()]
s[1] = [i for i in input()]
s[2] = [i for i in input()]
s[3] = [i for i in input()]
a = 0
for i in range(4):
	for j in range(4):
		if i > 1:
			if s[i][j] == '.' and s[i - 1][j] == 'x' and (s[i - 2][j] == 'x'):
				print('YES')
				a = 1
				break
			if j > 1:
				if s[i][j] == '.' and s[i - 1][j - 1] == 'x' and (s[i - 2][j - 2] == 'x'):
					print('YES')
					a = 1
					break
			if j < 2:
				if s[i][j] == '.' and s[i - 1][j + 1] == 'x' and (s[i - 2][j + 2] == 'x'):
					print('YES')
					a = 1
					break
		if i < 2:
			if s[i][j] == '.' and s[i + 1][j] == 'x' and (s[i + 2][j] == 'x'):
				print('YES')
				a = 1
				break
			if j > 1:
				if s[i][j] == '.' and s[i + 1][j - 1] == 'x' and (s[i + 2][j - 2] == 'x'):
					print('YES')
					a = 1
					break
			if j < 2:
				if s[i][j] == '.' and s[i + 1][j + 1] == 'x' and (s[i + 2][j + 2] == 'x'):
					print('YES')
					a = 1
					break
		if j > 1:
			if s[i][j] == '.' and s[i][j - 1] == 'x' and (s[i][j - 2] == 'x'):
				print('YES')
				a = 1
				break
		if j < 2:
			if s[i][j] == '.' and s[i][j + 1] == 'x' and (s[i][j + 2] == 'x'):
				print('YES')
				a = 1
				break
		if i != 3 and i != 0:
			if s[i][j] == '.' and s[i + 1][j] == 'x' and (s[i - 1][j] == 'x'):
				print('YES')
				a = 1
				break
			if j != 3 and j != 0:
				if s[i][j] == '.' and s[i + 1][j + 1] == 'x' and (s[i - 1][j - 1] == 'x'):
					print('YES')
					a = 1
					break
				if s[i][j] == '.' and s[i - 1][j + 1] == 'x' and (s[i + 1][j - 1] == 'x'):
					print('YES')
					a = 1
					break
		if j != 3 and j != 0:
			if s[i][j] == '.' and s[i][j + 1] == 'x' and (s[i][j - 1] == 'x'):
				print('YES')
				a = 1
				break
	if a:
		break
else:
	print('NO')


b = [list(input().strip()) for _ in range(4)]
r = 'NO'

def check(b):
	for i in range(4):
		for j in range(2):
			if b[i][j] == 'x' and b[i][j + 1] == 'x' and (b[i][j + 2] == 'x'):
				return True
	for i in range(2):
		for j in range(4):
			if b[i][j] == 'x' and b[i + 1][j] == 'x' and (b[i + 2][j] == 'x'):
				return True
	for i in range(2):
		for j in range(2):
			if b[i][j] == 'x' and b[i + 1][j + 1] == 'x' and (b[i + 2][j + 2] == 'x'):
				return True
	for i in range(2):
		for j in range(2, 4):
			if b[i][j] == 'x' and b[i + 1][j - 1] == 'x' and (b[i + 2][j - 2] == 'x'):
				return True
	return False
for i in range(4):
	for j in range(4):
		c = b[i][j]
		if c == '.':
			b[i][j] = 'x'
			if check(b):
				r = 'YES'
			b[i][j] = '.'
print(r)


a = []
for i in range(4):
	a.append(input())
b = ['.xx', 'x.x', 'xx.']
for i in range(4):
	if a[i][0] + a[i][1] + a[i][2] in b or a[i][1] + a[i][2] + a[i][3] in b:
		print('YES')
		exit(0)
	if a[0][i] + a[1][i] + a[2][i] in b or a[1][i] + a[2][i] + a[3][i] in b:
		print('YES')
		exit(0)
for i in range(2):
	for j in range(2):
		if a[i][j] + a[i + 1][j + 1] + a[i + 2][j + 2] in b or a[i + 2][j] + a[i + 1][j + 1] + a[i][j + 2] in b:
			print('YES')
			exit(0)
print('NO')


line = [[] for i in range(4)]
for i in range(4):
	s = input()
	ss = []
	for j in range(4):
		ss += [s[j]]
	line[i] = ss
m = False
for i in range(4):
	for j in range(2):
		if line[i][j] == 'x' and line[i][j + 1] == 'x' and (line[i][j + 2] == '.'):
			m = True
		if line[i][3 - j] == 'x' and line[i][2 - j] == 'x' and (line[i][1 - j] == '.'):
			m = True
		if line[i][j] == 'x' and line[i][j + 2] == 'x' and (line[i][j + 1] == '.'):
			m = True
for i in range(4):
	for j in range(2):
		if line[j][i] == 'x' and line[j + 1][i] == 'x' and (line[j + 2][i] == '.'):
			m = True
		if line[3 - j][i] == 'x' and line[2 - j][i] == 'x' and (line[1 - j][i] == '.'):
			m = True
		if line[j][i] == 'x' and line[j + 2][i] == 'x' and (line[j + 1][i] == '.'):
			m = True
for i in range(2):
	for j in range(2):
		if line[i][j] == 'x' and line[i + 1][j + 1] == 'x' and (line[i + 2][j + 2] == '.'):
			m = True
		if line[i][j] == 'x' and line[i + 2][j + 2] == 'x' and (line[i + 1][j + 1] == '.'):
			m = True
		if line[i][j] == '.' and line[i + 2][j + 2] == 'x' and (line[i + 1][j + 1] == 'x'):
			m = True
for i in range(2, 4):
	for j in range(2):
		if line[i][j] == 'x' and line[i - 1][j + 1] == 'x' and (line[i - 2][j + 2] == '.'):
			m = True
		if line[i][j] == 'x' and line[i - 2][j + 2] == 'x' and (line[i - 1][j + 1] == '.'):
			m = True
		if line[i][j] == '.' and line[i - 2][j + 2] == 'x' and (line[i - 1][j + 1] == 'x'):
			m = True
if m:
	print('YES')
else:
	print('NO')


import sys
rows = [input() for i in range(4)]
cols = []
for j in range(4):
	col = [rows[i][j] for i in range(4)]
	cols.append(''.join(col))
diags = []
diags.append(''.join([rows[i][i] for i in range(4)]))
diags.append(''.join([rows[0][1], rows[1][2], rows[2][3]]))
diags.append(''.join([rows[1][0], rows[2][1], rows[3][2]]))
diags.append(''.join([rows[i][3 - i] for i in range(4)]))
diags.append(''.join([rows[0][2], rows[1][1], rows[2][0]]))
diags.append(''.join([rows[1][3], rows[2][2], rows[3][1]]))
strs = rows + cols + diags
winstrs = ['xx.', 'x.x', '.xx']
for winstr in winstrs:
	for s in strs:
		if winstr in s:
			print('YES')
			return
print('NO')


matriz = []
s = False
for i in range(4):
	lista = input()
	matriz.append(lista)
for i in range(4):
	if str(matriz[i]).find('.xx') != -1 or str(matriz[i]).find('x.x') != -1 or str(matriz[i]).find('xx.') != -1:
		s = True
		break
for i in range(4):
	aux = ''
	for j in range(4):
		aux += matriz[j][i]
	if aux.find('.xx') != -1 or aux.find('x.x') != -1 or aux.find('xx.') != -1:
		s = True
		break
aux = ''
for i in range(4):
	aux += matriz[i][i]
	if aux.find('.xx') != -1 or aux.find('x.x') != -1 or aux.find('xx.') != -1:
		s = True
		break
aux = ''
for i in range(3):
	aux += matriz[i][i + 1]
if aux.find('.xx') != -1 or aux.find('x.x') != -1 or aux.find('xx.') != -1:
	s = True
aux = ''
for i in range(3):
	aux += matriz[i + 1][i]
if aux.find('.xx') != -1 or aux.find('x.x') != -1 or aux.find('xx.') != -1:
	s = True
aux = ''
for i in range(4):
	aux += matriz[i][3 - i]
if aux.find('.xx') != -1 or aux.find('x.x') != -1 or aux.find('xx.') != -1:
	s = True
aux = ''
for i in range(3):
	aux += matriz[i][3 - 1 - i]
if aux.find('.xx') != -1 or aux.find('x.x') != -1 or aux.find('xx.') != -1:
	s = True
aux = ''
for i in range(1, 4, 1):
	aux += matriz[i][4 - i]
if aux.find('.xx') != -1 or aux.find('x.x') != -1 or aux.find('xx.') != -1:
	s = True
if s == True:
	print('YES')
else:
	print('NO')


from math import *
from sys import *
from decimal import *

def gcd(a, b):
	if b:
		return gcd(b, a % b)
	return a
mat = []
for i in range(4):
	mat.append(input())
for st in mat:
	if 'xx.' in st or '.xx' in st or 'x.x' in st:
		print('YES')
		exit(0)
for i in range(4):
	st = ''
	for j in range(4):
		st += mat[j][i]
	if 'xx.' in st or '.xx' in st or 'x.x' in st:
		print('YES')
		exit(0)
for su in range(2, 5):
	st = ''
	for j in range(max(0, su - 3), min(su + 1, 4)):
		st += mat[j][su - j]
	if 'xx.' in st or '.xx' in st or 'x.x' in st:
		print('YES')
		exit(0)
for ee in range(-1, 2):
	st = ''
	for j in range(max(0, -ee), min(4, 4 - ee)):
		st += mat[j][j + ee]
	if 'xx.' in st or '.xx' in st or 'x.x' in st:
		print('YES')
		exit(0)
print('NO')


PAT = ['xx.', 'x.x', '.xx']
s = [input() for i in range(4)]
res = 'NO'
for i in range(4):
	if s[i][0] + s[i][1] + s[i][2] in PAT or s[i][1] + s[i][2] + s[i][3] in PAT:
		res = 'YES'
for j in range(4):
	if s[0][j] + s[1][j] + s[2][j] in PAT or s[1][j] + s[2][j] + s[3][j] in PAT:
		res = 'YES'
for i in range(1, 3):
	for j in range(1, 3):
		if s[i - 1][j - 1] + s[i][j] + s[i + 1][j + 1] in PAT or s[i - 1][j + 1] + s[i][j] + s[i + 1][j - 1] in PAT:
			res = 'YES'
print(res)


T = [[] for i in range(4)]
for i in range(4):
	T[i] = list(input())
for k in range(4):
	for i in range(2):
		tmp = 0
		for j in range(3):
			if T[k][i + j] == '.':
				tmp += 1
			elif T[k][i + j] == 'o':
				tmp = 0
				break
		if tmp == 1:
			print('YES')
			exit()
for k in range(4):
	for i in range(2):
		tmp = 0
		for j in range(3):
			if T[i + j][k] == '.':
				tmp += 1
			elif T[i + j][k] == 'o':
				tmp = 0
				break
		if tmp == 1:
			print('YES')
			exit()
for (s, t) in [(0, 0), (1, 0), (0, 1), (1, 1)]:
	tmp = 0
	for j in range(3):
		if T[s + j][t + j] in '.':
			tmp += 1
		elif T[s + j][t + j] == 'o':
			tmp = 0
			break
	if tmp == 1:
		print('YES')
		exit()
for (s, t) in [(0, 3), (0, 2), (1, 3), (1, 2)]:
	tmp = 0
	for j in range(3):
		if T[s + j][t - j] == '.':
			tmp += 1
		elif T[s + j][t - j] == 'o':
			tmp = 0
			break
	if tmp == 1:
		print('YES')
		exit()
print('NO')


l = []
for i in range(4):
	l.append(input())
ans = 0
a = b = c = d = ''
for i in range(4):
	for j in range(4):
		if j < 2:
			a = l[i][j] + l[i][j + 1] + l[i][j + 2]
		if i < 2:
			b = l[i][j] + l[i + 1][j] + l[i + 2][j]
		if i < 2 and j < 2:
			c = l[i][j] + l[i + 1][j + 1] + l[i + 2][j + 2]
		if i < 2 and j > 1:
			d = l[i][j] + l[i + 1][j - 1] + l[i + 2][j - 2]
		for k in (a, b, c, d):
			if k.count('.') == 1 and k.count('x') == 2:
				ans = 1
print('YES' if ans else 'NO')


T = {}
for i in range(4):
	s = input()
	for (j, c) in enumerate(s):
		if c == 'x':
			T[i, j] = 'x'
		elif c == 'o':
			T[i, j] = 'o'

def test(T, a):
	e = 0
	oc = 0
	for (i, j) in a:
		if (i, j) in T:
			if T[i, j] == 'x':
				oc += 1
		else:
			e += 1
	if e == 1 and oc == 2:
		return True
	else:
		return False
check = [[(0, 1), (1, 2), (2, 3)], [(0, 0), (1, 1), (2, 2)], [(1, 1), (2, 2), (3, 3)], [(1, 0), (2, 1), (3, 2)], [(2, 0), (1, 1), (0, 2)], [(3, 0), (2, 1), (1, 2)], [(2, 1), (1, 2), (0, 3)], [(3, 1), (2, 2), (1, 3)]]
check.extend([[(i, j) for j in range(3)] for i in range(4)])
check.extend([[(i, j) for j in range(1, 4)] for i in range(4)])
check.extend([[(j, i) for j in range(3)] for i in range(4)])
check.extend([[(j, i) for j in range(1, 4)] for i in range(4)])
for x in check:
	if test(T, x):
		print('YES')
		break
else:
	print('NO')


def check(i, j):
	if j - 2 in range(4):
		if field[i][j - 2] == 1 and field[i][j - 1] == 1:
			return True
	if j + 2 in range(4):
		if field[i][j + 1] == 1 and field[i][j + 2] == 1:
			return True
	if i + 2 in range(4):
		if field[i + 1][j] == 1 and field[i + 2][j] == 1:
			return True
	if i - 2 in range(4):
		if field[i - 1][j] == 1 and field[i - 2][j] == 1:
			return True
	if i + 1 in range(4) and i + 2 in range(4) and (j + 1 in range(4)) and (j + 2 in range(4)):
		if field[i + 1][j + 1] == 1 and field[i + 2][j + 2] == 1:
			return True
	if i - 1 in range(4) and i - 2 in range(4) and (j - 1 in range(4)) and (j - 2 in range(4)):
		if field[i - 1][j - 1] == 1 and field[i - 2][j - 2] == 1:
			return True
	if i + 1 in range(4) and i + 2 in range(4) and (j - 1 in range(4)) and (j - 2 in range(4)):
		if field[i + 1][j - 1] == 1 and field[i + 2][j - 2] == 1:
			return True
	if i - 1 in range(4) and i - 2 in range(4) and (j + 1 in range(4)) and (j + 2 in range(4)):
		if field[i - 1][j + 1] == 1 and field[i - 2][j + 2] == 1:
			return True
	if j - 1 in range(4) and j + 1 in range(4):
		if field[i][j - 1] == 1 and field[i][j + 1] == 1:
			return True
	if i - 1 in range(4) and i + 1 in range(4):
		if field[i - 1][j] == 1 and field[i + 1][j] == 1:
			return True
	if i - 1 in range(4) and j - 1 in range(4) and (i + 1 in range(4)) and (j + 1 in range(4)):
		if field[i - 1][j - 1] == 1 and field[i + 1][j + 1] == 1 or (field[i - 1][j + 1] == 1 and field[i + 1][j - 1] == 1):
			return True
	return False
field = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
for i in range(4):
	j = 0
	for x in input():
		if x == 'x':
			tmp = 1
		elif x == 'o':
			tmp = 2
		else:
			tmp = 0
		field[i][j] = tmp
		j += 1
yes = False
for i in range(4):
	for j in range(4):
		if field[i][j] == 0:
			if check(i, j):
				print('YES')
				yes = True
				break
	if yes:
		break
if not yes:
	print('NO')


a = [[0 for i in range(4)] for j in range(4)]
for i in range(4):
	m = list(input())
	for j in range(len(m)):
		a[i][j] = m[j]
for i in range(4):
	for j in range(4):
		if a[i][j] == '.':
			a[i][j] = 'x'
			if a[i][0] == 'x' and a[i][1] == 'x' and (a[i][2] == 'x'):
				print('YES')
				exit()
			if a[i][1] == 'x' and a[i][2] == 'x' and (a[i][3] == 'x'):
				print('YES')
				exit()
			if a[0][j] == 'x' and a[1][j] == 'x' and (a[2][j] == 'x'):
				print('YES')
				exit()
			if a[1][j] == 'x' and a[2][j] == 'x' and (a[3][j] == 'x'):
				print('YES')
				exit()
			if i <= 1 and j <= 1:
				if a[i][j] == 'x' and a[i + 1][j + 1] == 'x' and (a[i + 2][j + 2] == 'x'):
					print('YES')
					exit()
			if i <= 1 and j >= 2:
				if a[i][j] == 'x' and a[i + 1][j - 1] == 'x' and (a[i + 2][j - 2] == 'x'):
					print('YES')
					exit()
			if i >= 2 and j <= 1:
				if a[i][j] == 'x' and a[i - 1][j + 1] == 'x' and (a[i - 2][j + 2] == 'x'):
					print('YES')
					exit()
			if i >= 2 and j >= 2:
				if a[i][j] == 'x' and a[i - 1][j - 1] == 'x' and (a[i - 2][j - 2] == 'x'):
					print('YES')
					exit()
			if (i == 1 or i == 2) and j == 1:
				if a[i][j] == 'x' and a[i - 1][j - 1] == 'x' and (a[i + 1][j + 1] == 'x'):
					print('YES')
					exit()
				if a[i][j] == 'x' and a[i - 1][j + 1] == 'x' and (a[i + 1][j - 1] == 'x'):
					print('YES')
					exit()
			if (i == 1 or i == 2) and j == 2:
				if a[i][j] == 'x' and a[i - 1][j + 1] == 'x' and (a[i + 1][j - 1] == 'x'):
					print('YES')
					exit()
				if a[i][j] == 'x' and a[i - 1][j - 1] == 'x' and (a[i + 1][j + 1] == 'x'):
					print('YES')
					exit()
			a[i][j] = '.'
print('NO')


board = []
for i in range(4):
	board.append(input())

def isX(i, j):
	if 0 <= i < 4 and 0 <= j < 4:
		return board[i][j] == 'x'
	return False

def win(i, j):
	if isX(i - 1, j - 1) and (isX(i - 2, j - 2) or isX(i + 1, j + 1)):
		return True
	if isX(i - 1, j) and (isX(i - 2, j) or isX(i + 1, j)):
		return True
	if isX(i - 1, j + 1) and (isX(i - 2, j + 2) or isX(i + 1, j - 1)):
		return True
	if isX(i, j - 1) and (isX(i, j - 2) or isX(i, j + 1)):
		return True
	if isX(i, j + 1) and isX(i, j + 2):
		return True
	if isX(i + 1, j - 1) and isX(i + 2, j - 2):
		return True
	if isX(i + 1, j) and isX(i + 2, j):
		return True
	if isX(i + 1, j + 1) and isX(i + 2, j + 2):
		return True
	return False
for i in range(4):
	for j in range(4):
		if board[i][j] == '.' and win(i, j):
			print('YES')
			break
	else:
		continue
	break
else:
	print('NO')


A = []
for _ in range(4):
	A += [list(input())]
found = False

def check(list_of_sigs):
	return list_of_sigs.count('.') == 1 and list_of_sigs.count('x') == 2
for col_offset in range(2):
	for row_offset in range(2):
		found = found or check([A[row_offset][col_offset], A[row_offset + 1][col_offset + 1], A[row_offset + 2][col_offset + 2]])
		found = found or check([A[row_offset][3 - col_offset], A[row_offset + 1][2 - col_offset], A[row_offset + 2][1 - col_offset]])
for col in range(2):
	for row in range(4):
		found = found or check([A[row][col], A[row][col + 1], A[row][col + 2]])
for col in range(4):
	for row in range(2):
		found = found or check([A[row][col], A[row + 1][col], A[row + 2][col]])
if found:
	print('YES')
else:
	print('NO')


def vaild(i, j):
	per = 1
	per1 = 1
	per2 = 1
	per3 = 1
	for t in range(i - 1, -1, -1):
		if A[t][j] == 'x':
			per += 1
		else:
			break
	for t in range(i + 1, 4):
		if A[t][j] == 'x':
			per += 1
		else:
			break
	if per >= 3:
		return True
	for t in range(j - 1, -1, -1):
		if A[i][t] == 'x':
			per1 += 1
		else:
			break
	for t in range(j + 1, 4):
		if A[i][t] == 'x':
			per1 += 1
		else:
			break
	if per1 >= 3:
		return True
	i1 = i - 1
	j1 = j - 1
	i2 = i + 1
	j2 = j + 1
	while i1 >= 0 and j1 >= 0:
		if A[i1][j1] == 'x':
			i1 -= 1
			j1 -= 1
			per2 += 1
		else:
			break
	while i2 <= 3 and j2 <= 3:
		if A[i2][j2] == 'x':
			per2 += 1
			i2 += 1
			j2 += 1
		else:
			break
	if per2 >= 3:
		return True
	i3 = i - 1
	j3 = j + 1
	while i3 >= 0 and j3 <= 3:
		if A[i3][j3] == 'x':
			i3 -= 1
			j3 += 1
			per3 += 1
		else:
			break
	i4 = i + 1
	j4 = j - 1
	while i4 <= 3 and j4 >= 0:
		if A[i4][j4] == 'x':
			i4 += 1
			j4 -= 1
			per3 += 1
		else:
			break
	if per3 >= 3:
		return True
	return False
A = [0] * 4
for j in range(4):
	A[j] = input()
s = 0
for i in range(4):
	for j in range(4):
		if A[i][j] == '.':
			if vaild(i, j):
				s = 1
				break
if s == 1:
	print('YES')
else:
	print('NO')


def get_field(i, j, val):
	if i < 0 or j < 0 or i > 3 or (j > 3):
		return False
	return d[i][j] == val

def check_field(i, j, c):
	if get_field(i - 2, j, c) and get_field(i - 1, j, c):
		return True
	if get_field(i + 2, j, c) and get_field(i + 1, j, c):
		return True
	if get_field(i, j - 2, c) and get_field(i, j - 1, c):
		return True
	if get_field(i, j + 2, c) and get_field(i, j + 1, c):
		return True
	if get_field(i - 1, j, c) and get_field(i + 1, j, c):
		return True
	if get_field(i, j - 1, c) and get_field(i, j + 1, c):
		return True
	if get_field(i + 2, j + 2, c) and get_field(i + 1, j + 1, c):
		return True
	if get_field(i - 2, j - 2, c) and get_field(i - 1, j - 1, c):
		return True
	if get_field(i + 2, j - 2, c) and get_field(i + 1, j - 1, c):
		return True
	if get_field(i - 2, j + 2, c) and get_field(i - 1, j + 1, c):
		return True
	if get_field(i + 1, j + 1, c) and get_field(i - 1, j - 1, c):
		return True
	if get_field(i - 1, j + 1, c) and get_field(i + 1, j - 1, c):
		return True
d = [[''] * 4 for i in range(4)]
for i in range(4):
	s = input()
	for j in range(4):
		d[i][j] = s[j]
for i in range(4):
	for j in range(4):
		if d[i][j] == '.':
			if check_field(i, j, 'x'):
				print('YES')
				return
print('NO')


t = [input() for _ in range(4)]
w = ['xx.', '.xx', 'x.x']
if any((i in j for i in w for j in t)):
	print('YES')
else:
	for p in range(4):
		c = ''.join([r[p] for r in t])
		if any((i in c for i in w)):
			print('YES')
			break
	else:
		d = [t[0][0] + t[1][1] + t[2][2] + t[3][3], t[1][0] + t[2][1] + t[3][2], t[0][1] + t[1][2] + t[2][3], t[3][0] + t[2][1] + t[1][2] + t[0][3], t[2][0] + t[1][1] + t[0][2], t[3][1] + t[2][2] + t[1][3]]
		if any((i in j for i in w for j in d)):
			print('YES')
		else:
			print('NO')


q = [input() for i in range(4)]

def f(a, s):
	b = True
	w = 0
	for i in range(3):
		if q[a + i][s + i] == 'x':
			w += 1
		elif q[a + i][s + i] == 'o':
			b = False
			break
	return b & (w == 2)

def d(a, s):
	b = True
	w = 0
	for i in range(3):
		if q[a - i][s + i] == 'x':
			w += 1
		elif q[a - i][s + i] == 'o':
			b = False
			break
	return b & (w == 2)

def g(a, s):
	b = True
	w = 0
	for i in range(3):
		if q[a + i][s] == 'x':
			w += 1
		elif q[a + i][s] == 'o':
			b = False
			break
	return b & (w == 2)

def h(a, s):
	b = True
	w = 0
	for i in range(3):
		if q[a][s + i] == 'x':
			w += 1
		elif q[a][s + i] == 'o':
			b = False
			break
	return b & (w == 2)
b = f(0, 0) | f(1, 1) | f(1, 0) | f(0, 1) | d(3, 0) | d(3, 1) | d(2, 0) | d(2, 1) | g(0, 0) | g(1, 0) | g(0, 1) | g(1, 1) | g(0, 2) | g(1, 2) | g(0, 3) | g(1, 3) | h(0, 0) | h(0, 1) | h(1, 0) | h(1, 1) | h(2, 0) | h(2, 1) | h(3, 0) | h(3, 1)
print('YES' if b else 'NO')


arr = []
c = False
for i in range(0, 4):
	arr.append(input())
for i in range(0, 4):
	if arr[i][0] == 'x' and arr[i][1] == 'x' and (arr[i][2] == '.'):
		c = True
	elif arr[i][1] == 'x' and arr[i][2] == 'x' and (arr[i][0] == '.'):
		c = True
	elif arr[i][1] == '.' and arr[i][2] == 'x' and (arr[i][0] == 'x'):
		c = True
	elif arr[i][1] == 'x' and arr[i][2] == 'x' and (arr[i][3] == '.'):
		c = True
	elif arr[i][2] == 'x' and arr[i][3] == 'x' and (arr[i][1] == '.'):
		c = True
	elif arr[i][2] == '.' and arr[i][3] == 'x' and (arr[i][1] == 'x'):
		c = True
for i in range(0, 4):
	if arr[0][i] == 'x' and arr[1][i] == 'x' and (arr[2][i] == '.'):
		c = True
	elif arr[1][i] == 'x' and arr[2][i] == 'x' and (arr[0][i] == '.'):
		c = True
	elif arr[1][i] == '.' and arr[2][i] == 'x' and (arr[0][i] == 'x'):
		c = True
	elif arr[1][i] == 'x' and arr[2][i] == 'x' and (arr[3][i] == '.'):
		c = True
	elif arr[2][i] == 'x' and arr[3][i] == 'x' and (arr[1][i] == '.'):
		c = True
	elif arr[2][i] == '.' and arr[3][i] == 'x' and (arr[1][i] == 'x'):
		c = True
if arr[2][0] == 'x' and arr[1][1] == 'x' and (arr[0][2] == '.'):
	c = True
elif arr[2][0] == '.' and arr[1][1] == 'x' and (arr[0][2] == 'x'):
	c = True
elif arr[2][0] == 'x' and arr[1][1] == '.' and (arr[0][2] == 'x'):
	c = True
elif arr[3][1] == 'x' and arr[2][2] == 'x' and (arr[1][3] == '.'):
	c = True
elif arr[3][1] == '.' and arr[2][2] == 'x' and (arr[1][3] == 'x'):
	c = True
elif arr[3][1] == 'x' and arr[2][2] == '.' and (arr[1][3] == 'x'):
	c = True
elif arr[1][0] == 'x' and arr[2][1] == 'x' and (arr[3][2] == '.'):
	c = True
elif arr[1][0] == '.' and arr[2][1] == 'x' and (arr[3][2] == 'x'):
	c = True
elif arr[1][0] == 'x' and arr[2][1] == '.' and (arr[3][2] == 'x'):
	c = True
elif arr[0][1] == 'x' and arr[1][2] == 'x' and (arr[2][3] == '.'):
	c = True
elif arr[0][1] == '.' and arr[1][2] == 'x' and (arr[2][3] == 'x'):
	c = True
elif arr[0][1] == 'x' and arr[1][2] == '.' and (arr[2][3] == 'x'):
	c = True
elif arr[0][0] == 'x' and arr[1][1] == 'x' and (arr[2][2] == '.'):
	c = True
elif arr[0][0] == '.' and arr[1][1] == 'x' and (arr[2][2] == 'x'):
	c = True
elif arr[0][0] == 'x' and arr[1][1] == '.' and (arr[2][2] == 'x'):
	c = True
elif arr[1][1] == 'x' and arr[2][2] == 'x' and (arr[3][3] == '.'):
	c = True
elif arr[1][1] == '.' and arr[2][2] == 'x' and (arr[3][3] == 'x'):
	c = True
elif arr[1][1] == 'x' and arr[2][2] == '.' and (arr[3][3] == 'x'):
	c = True
elif arr[3][0] == 'x' and arr[2][1] == 'x' and (arr[1][2] == '.'):
	c = True
elif arr[3][0] == '.' and arr[2][1] == 'x' and (arr[1][2] == 'x'):
	c = True
elif arr[3][0] == 'x' and arr[2][1] == '.' and (arr[1][2] == 'x'):
	c = True
elif arr[2][1] == 'x' and arr[1][2] == 'x' and (arr[0][3] == '.'):
	c = True
elif arr[2][1] == '.' and arr[1][2] == 'x' and (arr[0][3] == 'x'):
	c = True
elif arr[2][1] == 'x' and arr[1][2] == '.' and (arr[0][3] == 'x'):
	c = True
if c == False:
	print('NO')
else:
	print('YES')


board = [input() for i in range(4)]

def test(board, ps):
	empty = 0
	cross = 0
	for (i, j) in ps:
		if board[i][j] == 'x':
			cross += 1
		elif board[i][j] == '.':
			empty += 1
	return empty == 1 and cross == 2
check = [([(i, j) for j in range(3)] for i in range(4)), ([(i, j) for j in range(1, 4)] for i in range(4)), ([(i, j) for i in range(3)] for j in range(4)), ([(i, j) for i in range(1, 4)] for j in range(4)), ([(i + k, j + k) for k in range(3)] for i in range(2) for j in range(2)), ([(i + k, j - k) for k in range(3)] for i in range(2) for j in range(2, 4))]
for i in check:
	for j in i:
		if test(board, j):
			print('YES')
			break
	else:
		continue
	break
else:
	print('NO')


p = [input() for _ in range(4)]
won = False
target = ['.xx', 'x.x', 'xx.']
for z in p:
	for t in target:
		if t in z:
			won = True
			break
for i in range(2):
	for j in range(2):
		s = ''
		t = ''
		for k in range(3):
			s += p[i + k][j + k]
			t += p[i + k][3 - (j + k)]
		if s in target:
			won = True
			break
		if t in target:
			won = True
			break
for i in range(4):
	s = ''
	for j in range(4):
		s += p[j][i]
	for t in target:
		if t in s:
			won = True
			break
print('YES' if won else 'NO')


def check_win(board):
	for row in board:
		if row[0:3] == 'xxx':
			return True
		if row[1:4] == 'xxx':
			return True
	for col_num in range(len(board)):
		if board[0][col_num] == board[1][col_num] == board[2][col_num] == 'x':
			return True
		if board[1][col_num] == board[2][col_num] == board[3][col_num] == 'x':
			return True
	if board[0][0] == board[1][1] == board[2][2] == 'x':
		return True
	if board[0][1] == board[1][2] == board[2][3] == 'x':
		return True
	if board[1][0] == board[2][1] == board[3][2] == 'x':
		return True
	if board[1][1] == board[2][2] == board[3][3] == 'x':
		return True
	if board[3][0] == board[2][1] == board[1][2] == 'x':
		return True
	if board[3][1] == board[2][2] == board[1][3] == 'x':
		return True
	if board[2][0] == board[1][1] == board[0][2] == 'x':
		return True
	if board[2][1] == board[1][2] == board[0][3] == 'x':
		return True
	return False

def codeforces(board):
	for row_num in range(len(board)):
		for elem_num in range(len(board[row_num])):
			if board[row_num][elem_num] == '.':
				board[row_num] = board[row_num][:elem_num] + 'x' + board[row_num][elem_num + 1:]
				if check_win(board):
					return 'YES'
				board[row_num] = board[row_num][:elem_num] + '.' + board[row_num][elem_num + 1:]
	return 'NO'
board = []
for _ in range(4):
	row = input()
	board.append(row)
print(codeforces(board))


field = [input(), input(), input(), input()]

def printAnswer(b):
	if b:
		print('YES')
	else:
		print('NO')
	exit()

def checkH(field, x, y):
	xx = oo = 0
	for i in range(x, x + 3):
		if field[y][i] == 'x':
			xx += 1
		elif field[y][i] == 'o':
			oo += 1
	if xx == 2 and oo == 0:
		printAnswer(True)
	return False

def checkV(field, x, y):
	xx = oo = 0
	for i in range(y, y + 3):
		if field[i][x] == 'x':
			xx += 1
		elif field[i][x] == 'o':
			oo += 1
	if xx == 2 and oo == 0:
		printAnswer(True)
	return False

def checkD(field, x, y):
	xx = oo = 0
	for d in range(0, 3):
		if field[y + d][x + d] == 'x':
			xx += 1
		elif field[y + d][x + d] == 'o':
			oo += 1
	if xx == 2 and oo == 0:
		printAnswer(True)
	return False

def checkRD(field, x, y):
	xx = oo = 0
	for d in range(0, 3):
		if field[y + d][x - d + 2] == 'x':
			xx += 1
		elif field[y + d][x - d + 2] == 'o':
			oo += 1
	if xx == 2 and oo == 0:
		printAnswer(True)
	return False
for i in range(0, 4):
	checkH(field, 0, i)
	checkH(field, 1, i)
	checkV(field, i, 0)
	checkV(field, i, 1)
	checkD(field, i % 2, int(i / 2))
	checkRD(field, i % 2, int(i / 2))
printAnswer(False)


def check(AL):
	for i in AL:
		if i[:3].count('x') == 2 and '.' in i[:3] or (i[1:].count('x') == 2 and '.' in i[1:]):
			return True
	B = [[0, 0], [0, 1], [1, 0], [1, 1]]
	C = []
	for (a, b) in B:
		l = []
		for i in range(3):
			l.append(AL[a + i][b + i])
		C.append(l)
	for i in C:
		if i.count('x') == 2 and '.' in i:
			return True
	return False
A = []
for i in range(4):
	A.append(input())
D = []
for i in range(4):
	l = []
	for j in range(4):
		l.append(A[j][3 - i])
	D.append(l)
print('YES' if check(A) or check(D) else 'NO')


A = []
for i in range(4):
	A.append(input())
answer = False
answer_platform = ['xx.', 'x.x', '.xx']
for i in range(4):
	if A[i][0:3] in answer_platform or A[i][1:] in answer_platform:
		answer = True
	if A[0][i] + A[1][i] + A[2][i] in answer_platform or A[1][i] + A[2][i] + A[3][i] in answer_platform:
		answer = True
if A[1][0] + A[2][1] + A[3][2] in answer_platform or A[0][1] + A[1][2] + A[2][3] in answer_platform or A[0][0] + A[1][1] + A[2][2] in answer_platform or (A[1][1] + A[2][2] + A[3][3] in answer_platform):
	answer = True
if A[0][2] + A[1][1] + A[2][0] in answer_platform or A[1][3] + A[2][2] + A[3][1] in answer_platform or A[0][3] + A[1][2] + A[2][1] in answer_platform or (A[1][2] + A[2][1] + A[3][0] in answer_platform):
	answer = True
if answer:
	print('YES')
else:
	print('NO')


Field = []
for i in range(4):
	Field.append([x for x in input()])

def main(Field):
	for i in range(len(Field)):
		for j in range(len(Field[i])):
			if Field[i][j] == '.':
				Field[i][j] = 'x'
				if winner(Field):
					return 'YES'
				else:
					Field[i][j] = '.'
	return 'NO'

def winner(field):
	for row in field:
		if row[1] == 'x' and row[2] == 'x':
			if row[0] == 'x' or row[3] == 'x':
				return True
	for i in range(len(field)):
		if field[1][i] == field[2][i] == 'x':
			if field[0][i] == 'x' or field[3][i] == 'x':
				return True
	if field[0][1] == field[1][2] == field[2][3] == 'x':
		return True
	elif field[1][1] == field[2][2] == 'x':
		if field[0][0] == 'x' or field[3][3] == 'x':
			return True
	elif field[1][0] == field[2][1] == field[3][2] == 'x':
		return True
	if field[0][2] == field[1][1] == field[2][0] == 'x':
		return True
	elif field[1][2] == field[2][1] == 'x':
		if field[0][3] == 'x' or field[3][0] == 'x':
			return True
	elif field[1][3] == field[2][2] == field[3][1] == 'x':
		return True
	return False
print(main(Field))


rows = [input() for x in range(4)]
(columns, d1, d2, d3, d4, d5, d6) = ([''.join([x[y] for x in rows]) for y in range(4)], ''.join([rows[x][x] for x in range(4)]), ''.join([rows[x][3 - x] for x in range(4)]), ''.join([rows[x][2 - x] for x in range(3)]), ''.join([rows[x][x + 1] for x in range(3)]), ''.join([rows[x][x - 1] for x in range(1, 4)]), ''.join([rows[x][4 - x] for x in range(1, 4)]))
diagonals = [d1, d2, d3, d4, d5, d6]
lines = rows + columns + diagonals
for x in lines:
	y = x.replace('o', ' ')
	if 'x.x' in y or 'xx.' in y or '.xx' in y:
		print('YES')
		break
else:
	print('NO')


def chk(l):
	for i in range(4):
		for j in range(2):
			if l[i][j] == l[i][j + 1] == l[i][j + 2] == 'x':
				return True
	for i in range(2):
		for j in range(4):
			if l[i][j] == l[i + 1][j] == l[i + 2][j] == 'x':
				return True
	for i in range(2):
		for j in range(2):
			if l[i][j] == l[i + 1][j + 1] == l[i + 2][j + 2] == 'x':
				return True
	for i in range(2):
		for j in range(2, 4):
			if l[i][j] == l[i + 1][j - 1] == l[i + 2][j - 2] == 'x':
				return True
	return False
a = [list(input()), list(input()), list(input()), list(input())]
for i in range(4):
	for j in range(4):
		if a[i][j] != '.':
			continue
		a[i][j] = 'x'
		if chk(a):
			print('YES')
			return
		a[i][j] = '.'
print('NO')


import sys
import re
import math
import itertools
import collections
import bisect
mod = 1000000007
pi = 3.141592653589793
IS = float('inf')
xy = [(1, 0), (-1, 0), (0, 1), (0, -1)]
bs = [(-1, -1), (-1, 1), (1, 1), (1, -1)]

def niten(a, b):
	return abs(a - b) if a >= 0 and b >= 0 else a + abs(b) if a >= 0 else abs(a) + b if b >= 0 else abs(abs(a) - abs(b))

def fib(n):
	return [(seq.append(seq[i - 2] + seq[i - 1]), seq[i - 2])[1] for seq in [[0, 1]] for i in range(2, n)]

def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def lcm(a, b):
	return a * b / gcd(a, b)

def eucl(x1, y1, x2, y2):
	return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5

def choco(xa, ya, xb, yb, xc, yc, xd, yd):
	return 1 if abs((yb - ya) * (yd - yc) + (xb - xa) * (xd - xc)) < 1e-10 else 0

def pscl(num, l=[1]):
	for i in range(num):
		l = map(lambda x, y: x + y, [0] + l, l + [0])
	return l
l = []
for i in range(4):
	x = input()
	if 'xx.' in x or '.xx' in x or 'x.x' in x:
		print('YES')
		exit()
	elif 'ooo' in x:
		print('NO')
		exit()
	l.append(x)
for i in range(2):
	for j in range(4):
		tate = l[i][j] + l[i + 1][j] + l[i + 2][j]
		if 'xx.' in tate or '.xx' in tate or 'x.x' in tate:
			print('YES')
			exit()
		elif 'ooo' in tate:
			print('NO')
			exit()
		if j >= 2:
			y = l[i][j] + l[i + 1][j - 1] + l[i + 2][j - 2]
			if 'xx.' in y or '.xx' in y or 'x.x' in y:
				print('YES')
				exit()
			elif 'ooo' in y:
				print('NO')
				exit()
		if j < 2:
			y = l[i][j] + l[i + 1][j + 1] + l[i + 2][j + 2]
			if 'xx.' in y or '.xx' in y or 'x.x' in y:
				print('YES')
				exit()
			elif 'ooo' in y:
				print('NO')
				exit()
print('NO')


def check(i, j):
	if field[i][j] == '.':
		if field[i - 1][j] == field[i + 1][j] and field[i - 1][j] == 'x':
			return True
		elif field[i - 2][j] == field[i - 1][j] and field[i - 1][j] == 'x':
			return True
		elif field[i + 2][j] == field[i + 1][j] and field[i + 1][j] == 'x':
			return True
		elif field[i][j + 1] == field[i][j - 1] and field[i][j - 1] == 'x':
			return True
		elif field[i][j + 2] == field[i][j + 1] and field[i][j + 1] == 'x':
			return True
		elif field[i][j - 2] == field[i][j - 1] and field[i][j - 1] == 'x':
			return True
		elif field[i - 1][j - 1] == field[i + 1][j + 1] and field[i - 1][j - 1] == 'x':
			return True
		elif field[i - 1][j - 1] == field[i - 2][j - 2] and field[i - 1][j - 1] == 'x':
			return True
		elif field[i + 2][j + 2] == field[i + 1][j + 1] and field[i + 1][j + 1] == 'x':
			return True
		elif field[i - 1][j + 1] == field[i + 1][j - 1] and field[i - 1][j + 1] == 'x':
			return True
		elif field[i - 2][j + 2] == field[i - 1][j + 1] and field[i - 1][j + 1] == 'x':
			return True
		elif field[i + 1][j - 1] == field[i + 2][j - 2] and field[i + 1][j - 1] == 'x':
			return True
	return False
field = [['o', 'o', 'o', 'o', 'o', 'o', 'o', 'o'], ['o', 'o', 'o', 'o', 'o', 'o', 'o', 'o']] + [['o', 'o'] + [i for i in input()] + ['o', 'o'] for i in range(4)] + [['o', 'o', 'o', 'o', 'o', 'o', 'o', 'o'], ['o', 'o', 'o', 'o', 'o', 'o', 'o', 'o']]
i = 2
j = 2
while j < 6 and (not check(i, j)):
	i += 1
	if i == 6:
		i = 2
		j += 1
if j == 6:
	print('NO')
else:
	print('YES')


n = 4

def check(f):
	nonlocal n
	for i in range(n):
		ok = True
		for j in range(n - 1):
			ok &= f[i][j] == 'x'
		if ok:
			return ok
		ok = True
		for j in range(1, n):
			ok &= f[i][j] == 'x'
		if ok:
			return ok
	for i in range(n):
		ok = True
		for j in range(n - 1):
			ok &= f[j][i] == 'x'
		if ok:
			return ok
		ok = True
		for j in range(1, n):
			ok &= f[j][i] == 'x'
		if ok:
			return ok
	ok = True
	for i in range(n - 1):
		ok &= f[i][i] == 'x'
	if ok:
		return ok
	ok = True
	for i in range(1, n):
		ok &= f[i][i] == 'x'
	if ok:
		return ok
	if f[1][0] == f[2][1] == f[3][2] == 'x' or f[0][1] == f[1][2] == f[2][3] == 'x':
		return True
	return f[3][0] == f[2][1] == f[1][2] == 'x' or f[0][3] == f[2][1] == f[1][2] == 'x' or f[2][0] == f[1][1] == f[0][2] == 'x' or (f[1][3] == f[2][2] == f[3][1] == 'x')
f = [list(input()) for i in range(n)]
for i in range(n):
	for j in range(n):
		if f[i][j] == '.':
			f[i][j] = 'x'
			if check(f):
				print('YES')
				return
			f[i][j] = '.'
print('NO')


def check(A):
	for x1 in range(4):
		for y1 in range(4):
			for x2 in range(4):
				for y2 in range(4):
					for x3 in range(4):
						for y3 in range(4):
							if A[x1][y1] == A[x2][y2] == A[x3][y3] == 'x':
								if x1 == x2 == x3 and y1 == y2 + 1 == y3 + 2:
									return True
								if y1 == y2 == y3 and x1 == x2 + 1 == x3 + 2:
									return True
								if x1 == x2 + 1 == x3 + 2 and y1 == y2 + 1 == y3 + 2:
									return True
								if x1 == x2 + 1 == x3 + 2 and y3 == y2 + 1 == y1 + 2:
									return True
	return False
A = [0] * 4
for i in range(4):
	A[i] = list(input())
for i in range(4):
	for j in range(4):
		if A[i][j] == '.':
			A[i][j] = 'x'
			if check(A):
				print('YES')
				return
			A[i][j] = '.'
print('NO')


def is_player_win(row):
	if row.find('xxx') != -1:
		return True
	return False

def has_best_step(playing_field):
	for row in playing_field:
		for i in range(4):
			if row[i] == '.':
				updated_row = row[:i] + 'x' + row[i + 1:]
				if is_player_win(updated_row):
					return True
	for i in range(2):
		for j in range(2):
			temp_s = ''.join([playing_field[i][j], playing_field[i + 1][j + 1], playing_field[i + 2][j + 2]])
			for k in range(3):
				if temp_s[k] == '.':
					updated_row = temp_s[:k] + 'x' + temp_s[k + 1:]
					if updated_row == 'xxx':
						return True
	for i in range(2):
		for j in range(3, 1, -1):
			temp_s = ''.join([playing_field[i][j], playing_field[i + 1][j - 1], playing_field[i + 2][j - 2]])
			for k in range(3):
				if temp_s[k] == '.':
					updated_row = temp_s[:k] + 'x' + temp_s[k + 1:]
					if updated_row == 'xxx':
						return True
	return False

def transpose(playing_field):
	new_field = []
	for i in range(4):
		temp = []
		for j in range(4):
			temp.append(playing_field[j][i])
		new_field.append(''.join(temp))
	return new_field

def main():
	playing_field = []
	for i in range(4):
		playing_field.append(input())
	if has_best_step(playing_field):
		print('YES')
	elif has_best_step(transpose(playing_field)):
		print('YES')
	else:
		print('NO')
main()


EMPTY = '.'
X_STEP = 'x'

def is_winning(field):
	sign = X_STEP
	N = len(field)
	length = 3
	for row in range(N - length + 1):
		for col in range(N):
			has_vertical = True
			for drow in range(length):
				if field[row + drow][col] != sign:
					has_vertical = False
					break
			if has_vertical:
				return True
	for row in range(N):
		for col in range(N - length + 1):
			has_horizontal = True
			for dcol in range(length):
				if field[row][col + dcol] != sign:
					has_horizontal = False
					break
			if has_horizontal:
				return True
	for row in range(N - length + 1):
		for col in range(N - length + 1):
			has_straight_diagonal = True
			for shift in range(length):
				if field[row + shift][col + shift] != sign:
					has_straight_diagonal = False
					break
			if has_straight_diagonal:
				return True
	for row in range(length - 1, N):
		for col in range(N - length + 1):
			has_inverse_diagonal = True
			for shift in range(length):
				if field[row - shift][col + shift] != sign:
					has_inverse_diagonal = False
					break
			if has_inverse_diagonal:
				return True
	return False

def can_win(field):
	for row in range(len(field)):
		for col in range(len(field[row])):
			if field[row][col] == EMPTY:
				field[row][col] = X_STEP
				can_win = is_winning(field)
				field[row][col] = EMPTY
				if can_win:
					return True
	return False
field = []
for _ in range(4):
	field.append([cell for cell in input()])
print('YES' if can_win(field) else 'NO')


def t(s):
	if s.find('xx.') != -1 or s.find('.xx') != -1 or s.find('x.x') != -1:
		return True
	else:
		return False
s1 = input()
s2 = input()
s3 = input()
s4 = input()
s5 = s1[0] + s2[0] + s3[0] + s4[0]
s6 = s1[1] + s2[1] + s3[1] + s4[1]
s7 = s1[2] + s2[2] + s3[2] + s4[2]
s8 = s1[3] + s2[3] + s3[3] + s4[3]
s9 = s1[0] + s2[1] + s3[2] + s4[3]
p1 = s1[3] + s2[2] + s3[1] + s4[0]
p2 = s1[1] + s2[2] + s3[3]
p3 = s2[0] + s3[1] + s4[2]
p4 = s1[2] + s2[1] + s3[0]
p5 = s2[3] + s3[2] + s4[1]
if t(s1) or t(s2) or t(s3) or t(s4) or t(s5) or t(s6) or t(s7) or t(s8) or t(s9) or t(p1) or t(p2) or t(p3) or t(p4) or t(p5):
	print('YES')
else:
	print('NO')


a = [None] * 4
a[0] = input()
a[1] = input()
a[2] = input()
a[3] = input()
b = [None] * 4
for i in range(4):
	b[i] = a[0][i] + a[1][i] + a[2][i] + a[3][i]
c = [a[0][2] + a[1][1] + a[2][0], a[0][3] + a[1][2] + a[2][1] + a[3][0], a[1][3] + a[2][2] + a[3][1], a[0][1] + a[1][2] + a[2][3]]
d = [a[0][0] + a[1][1] + a[2][2] + a[3][3], a[1][0] + a[2][1] + a[3][2], 'a', 'b']
f = True
for j in range(4):
	if a[j].count('.xx') or a[j].count('xx.') or a[j].count('x.x') != 0:
		print('YES')
		f = False
		break
	elif b[j].count('.xx') or b[j].count('xx.') or b[j].count('x.x') != 0:
		print('YES')
		f = False
		break
	elif c[j].count('.xx') or c[j].count('xx.') or c[j].count('x.x') != 0:
		print('YES')
		f = False
		break
	elif d[j].count('.xx') or d[j].count('xx.') or d[j].count('x.x') != 0:
		print('YES')
		f = False
		break
if f:
	print('NO')


def c(i, j):
	if i < 4 and j < 4 and (i >= 0) and (j >= 0):
		if a[i][j] == 'x':
			return True
	return False
a = [[x for x in input().strip()] for j in range(4)]
ans = True
for i in range(4):
	for j in range(4):
		if a[i][j] == '.':
			if c(i + 1, j) and c(i + 2, j):
				ans = False
			if c(i - 1, j) and c(i - 2, j):
				ans = False
			if c(i + 1, j + 1) and c(i + 2, j + 2):
				ans = False
			if c(i - 1, j - 1) and c(i - 2, j - 2):
				ans = False
			if c(i, j + 1) and c(i, j + 2):
				ans = False
			if c(i, j - 1) and c(i, j - 2):
				ans = False
			if c(i + 1, j - 1) and c(i + 2, j - 2):
				ans = False
			if c(i - 1, j + 1) and c(i - 2, j + 2):
				ans = False
			if c(i - 1, j - 1) and c(i + 1, j + 1):
				ans = False
			if c(i - 1, j) and c(i + 1, j):
				ans = False
			if c(i - 1, j + 1) and c(i + 1, j - 1):
				ans = False
			if c(i, j - 1) and c(i, j + 1):
				ans = False
if ans:
	print('NO')
else:
	print('YES')


L = [input() for i in range(4)]
yes = 0
for i in range(4):
	for j in range(4):
		c = L[i][j]
		b1 = L[i + 1][j] if i + 1 < 4 else ''
		b2 = L[i + 2][j] if i + 2 < 4 else ''
		l1 = L[i][j + 1] if j + 1 < 4 else ''
		l2 = L[i][j + 2] if j + 2 < 4 else ''
		d1 = L[i + 1][j + 1] if i + 1 < 4 and j + 1 < 4 else ''
		d2 = L[i + 2][j + 2] if i + 2 < 4 and j + 2 < 4 else ''
		k1 = L[i + 1][j - 1] if i + 1 < 4 and j - 1 >= 0 else ''
		k2 = L[i + 2][j - 2] if i + 2 < 4 and j - 2 >= 0 else ''
		R = [c, l1, l2]
		C = [c, b1, b2]
		D = [c, d1, d2]
		K = [c, k1, k2]
		ans = [X.count('x') == 2 and X.count('.') == 1 for X in [R, C, D, K]]
		if any(ans):
			yes = 1
			break
	if yes:
		break
print(['NO', 'YES'][yes])


m = []
for i in range(4):
	m.append(input())

def match(r, c, r2, c2):
	if r > 3 or c > 3 or r < 0 or (c < 0) or (r2 > 3) or (c2 > 3) or (r2 < 0) or (c2 < 0):
		return False
	return m[r][c] == 'x' and m[r2][c2] == 'x'

def check(r, c):
	if match(r, c + 1, r, c - 1) or match(r, c + 1, r, c + 2) or match(r, c - 1, r, c - 2) or match(r + 1, c, r - 1, c) or match(r + 1, c, r + 2, c) or match(r - 1, c, r - 2, c) or match(r + 1, c + 1, r - 1, c - 1) or match(r + 1, c + 1, r + 2, c + 2) or match(r - 1, c - 1, r - 2, c - 2) or match(r - 1, c + 1, r + 1, c - 1) or match(r - 1, c + 1, r - 2, c + 2) or match(r + 1, c - 1, r + 2, c - 2):
		return True
	return False

def solve():
	for row in range(4):
		for column in range(4):
			if m[row][column] == '.':
				if check(row, column):
					return 'YES'
	return 'NO'
print(solve())


A = [input() for _ in range(4)]
for lines in (A, A[::-1]):
	A += [[lines[i][i + 1] for i in range(3)]]
	A += [[lines[i][i] for i in range(4)]]
	A += [[lines[i + 1][i] for i in range(3)]]
	A += zip(*A[:4])
A = '_'.join(map(''.join, A))
print('YES' if any((line in A for line in ('.xx', 'x.x', 'xx.'))) else 'NO')


field = []
for i in range(4):
	field.append(list(input()))

def check_line(line):
	if len(line) < 3:
		return False
	for i in range(len(line) - 2):
		found = True
		for j in range(3):
			if line[i + j] != 'x':
				found = False
		if found:
			return True
	return False

def check_win(field):
	for i in range(4):
		if check_line(field[i]):
			return True
		if check_line([l[i] for l in field]):
			return True
	for i in range(4):
		if check_line([field[j][i + j] for j in range(4 - i)]):
			return True
		if check_line([field[j][i - j] for j in range(i + 1)]):
			return True
for i in range(4):
	for j in range(4):
		if field[i][j] == '.':
			field[i][j] = 'x'
			if check_win(field):
				print('YES')
				exit(0)
			if check_win(field[::-1]):
				print('YES')
				exit(0)
			field[i][j] = '.'
print('NO')


import sys
g = [input() for _ in range(4)]
for i in range(4):
	for j in range(4):
		if g[i][j] == 'x':
			if j < 2 and (g[i][j + 1] == 'x' and g[i][j + 2] != 'o' or (g[i][j + 2] == 'x' and g[i][j + 1] != 'o')):
				print('YES')
				sys.exit(0)
			if j < 3 and j > 0 and (g[i][j + 1] == 'x' and g[i][j - 1] != 'o'):
				print('YES')
				sys.exit(0)
			if i < 2 and (g[i + 1][j] == 'x' and g[i + 2][j] != 'o' or (g[i + 2][j] == 'x' and g[i + 1][j] != 'o')):
				print('YES')
				sys.exit(0)
			if i < 3 and i > 0 and (g[i + 1][j] == 'x' and g[i - 1][j] != 'o'):
				print('YES')
				sys.exit(0)
			if i < 2 and j < 2 and (g[i + 1][j + 1] == 'x' and g[i + 2][j + 2] != 'o' or (g[i + 1][j + 1] != 'o' and g[i + 2][j + 2] == 'x')):
				print('YES')
				sys.exit(0)
			if i < 3 and i > 0 and (j < 3) and (j > 0) and (g[i + 1][j + 1] == 'x' and g[i - 1][j - 1] != 'o'):
				print('YES')
				sys.exit(0)
			if i < 2 and j >= 2 and (g[i + 1][j - 1] == 'x' and g[i + 2][j - 2] != 'o' or (g[i + 1][j - 1] != 'o' and g[i + 2][j - 2] == 'x')):
				print('YES')
				sys.exit(0)
			if i < 3 and i > 0 and (j < 3) and (j > 0) and (g[i + 1][j - 1] == 'x' and g[i - 1][j + 1] != 'o'):
				print('YES')
				sys.exit(0)
print('NO')


def has_win(mat, r, c):
	for i in range(-1, 2):
		for j in range(-1, 2):
			if i == j and i == 0 or not 0 <= i + r < 4 or (not 0 <= j + c < 4):
				continue
			if mat[r + i][c + j] in ['x', '.']:
				tm = '.' if mat[r + i][c + j] == 'x' else 'x'
				if 0 <= r + 2 * i < 4 and 0 <= c + 2 * j < 4 and (mat[r + 2 * i][c + 2 * j] == tm):
					return True
	return False

def is_win(mat):
	for i in range(4):
		for j in range(4):
			if mat[i][j] == 'x' and has_win(mat, i, j):
				return True
	return False

def nput(n):
	for i in range(n):
		yield input()

def main():
	mat = [list(l) for l in nput(4)]
	if is_win(mat):
		print('YES')
	else:
		print('NO')
main()


f = [list(input()) for _ in range(4)]
directions = [(-1, -1), (-1, 0), (-1, 1), (0, -1)]

def rev(d):
	return (-d[0], -d[1])

def inside(x, y):
	return x >= 0 and x < 4 and (y >= 0) and (y < 4)

def how_many(x, y, d):
	s = 0
	(nx, ny) = (x + d[0], y + d[1])
	while inside(nx, ny) and f[ny][nx] == 'x':
		s += 1
		(nx, ny) = (nx + d[0], ny + d[1])
	return s

def win(x, y):
	if f[y][x] != '.':
		return False
	for d in directions:
		if how_many(x, y, d) + how_many(x, y, rev(d)) >= 2:
			return True
	return False

def check():
	for y in range(4):
		for x in range(4):
			if win(x, y):
				print('YES')
				return
	print('NO')
check()


a = []
for _ in range(4):
	a.append(input())
res = 'NO'
for (i, value) in enumerate(a):
	if 'x.x' in value or 'xx.' in value or '.xx' in value:
		res = 'YES'
		break
	for (j, vj) in enumerate(value):
		if a[i][j] == 'x' and i > 1:
			if a[i - 1][j] == '.' and a[i - 2][j] == 'x' or (a[i - 1][j] == 'x' and a[i - 2][j] == '.'):
				res = 'YES'
				break
			if j > 1 and (a[i - 1][j - 1] == '.' and a[i - 2][j - 2] == 'x' or (a[i - 1][j - 1] == 'x' and a[i - 2][j - 2] == '.')):
				res = 'YES'
				break
			if j < 2 and (a[i - 1][j + 1] == '.' and a[i - 2][j + 2] == 'x' or (a[i - 1][j + 1] == 'x' and a[i - 2][j + 2] == '.')):
				res = 'YES'
				break
		if a[i][j] == '.' and i > 1:
			if a[i - 1][j] == 'x' and a[i - 2][j] == 'x':
				res = 'YES'
				break
			if j > 1 and (a[i - 1][j - 1] == 'x' and a[i - 2][j - 2] == 'x'):
				res = 'YES'
				break
			if j < 2 and (a[i - 1][j + 1] == 'x' and a[i - 2][j + 2] == 'x'):
				res = 'YES'
				break
	if res == 'YES':
		break
print(res)


bo = []
for i in range(4):
	bo.append(input())
arr = []
for i in range(4):
	a = []
	for j in range(len(bo[i])):
		if bo[i][j] == 'x':
			a.append(1)
		elif bo[i][j] == 'o':
			a.append(2)
		else:
			a.append(0)
	arr.append(a)
st = 0
for i in range(4):
	for j in range(4):
		if j < 2:
			a = sorted([arr[i][j], arr[i][j + 1], arr[i][j + 2]])
			if a == [0, 1, 1]:
				st = 1
				print('YES')
				break
		if i < 2:
			a = sorted([arr[i][j], arr[i + 1][j], arr[i + 2][j]])
			if a == [0, 1, 1]:
				st = 1
				print('YES')
				break
		if j < 2 and i < 2:
			a = sorted([arr[i][j], arr[i + 1][j + 1], arr[i + 2][j + 2]])
			if a == [0, 1, 1]:
				st = 1
				print('YES')
				break
		if j < 2 and i >= 2:
			a = sorted([arr[i][j], arr[i - 1][j + 1], arr[i - 2][j + 2]])
			if a == [0, 1, 1]:
				st = 1
				print('YES')
				break
	if st == 1:
		break
if st == 0:
	print('NO')


import sys

def winlose(board):
	for i in range(4):
		if 'xxx' in ''.join(board[i]):
			return True
	t_board = list(map(list, zip(*board)))
	for i in range(4):
		if 'xxx' in ''.join(t_board[i]):
			return True
	d1 = board[0][0] + board[1][1] + board[2][2]
	d2 = board[1][1] + board[2][2] + board[3][3]
	d3 = board[0][1] + board[1][2] + board[2][3]
	d4 = board[1][0] + board[2][1] + board[3][2]
	d5 = board[0][3] + board[1][2] + board[2][1]
	d6 = board[1][2] + board[2][1] + board[3][0]
	d7 = board[0][2] + board[1][1] + board[2][0]
	d8 = board[1][3] + board[2][2] + board[3][1]
	if 'xxx' in {d1, d2, d3, d4, d5, d6, d7, d8}:
		return True
	else:
		return False
board = []
for _ in range(4):
	board.append(list(input()))
for i in range(4):
	for j in range(4):
		if board[i][j] == '.':
			board[i][j] = 'x'
			if winlose(board) == True:
				print('YES')
				sys.exit(0)
			board[i][j] = '.'
print('NO')


from sys import stdin, stdout
from os import path
rd = lambda : stdin.readline().strip()
wr = stdout.write
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
import time, math
mylist = []
for i in range(4):
	mylist.append(rd())

def validUpOrDown(x, y):
	if x + 2 < 4:
		counterX = counterD = 0
		for i in range(x, x + 3):
			if mylist[i][y] == 'x':
				counterX += 1
			elif mylist[i][y] == '.':
				counterD += 1
		if counterD == 1 and counterX == 2:
			return True
	if x - 2 >= 0:
		counterX = counterD = 0
		for i in range(x, x - 3, -1):
			if mylist[i][y] == 'x':
				counterX += 1
			elif mylist[i][y] == '.':
				counterD += 1
		if counterD == 1 and counterX == 2:
			return True

def validLeftOrRight(x, y):
	if y + 2 < 4:
		counterX = counterD = 0
		for i in range(y, y + 3):
			if mylist[x][i] == 'x':
				counterX += 1
			elif mylist[x][i] == '.':
				counterD += 1
		if counterD == 1 and counterX == 2:
			return True
	if y - 2 >= 0:
		counterX = counterD = 0
		for i in range(y, y - 3, -1):
			if mylist[x][i] == 'x':
				counterX += 1
			elif mylist[x][i] == '.':
				counterD += 1
		if counterD == 1 and counterX == 2:
			return True

def validDiagonal(x, y):
	if x + 2 < 4 and y + 2 < 4:
		counter = counterX = counterD = 0
		(x1, y1) = (x, y)
		while counter < 3:
			if mylist[x1][y1] == 'x':
				counterX += 1
			elif mylist[x1][y1] == '.':
				counterD += 1
			counter += 1
			x1 += 1
			y1 += 1
		if counterX == 2 and counterD == 1:
			return True
	if x + 2 < 4 and y - 2 >= 0:
		counter = counterX = counterD = 0
		(x1, y1) = (x, y)
		while counter < 3:
			if mylist[x1][y1] == 'x':
				counterX += 1
			elif mylist[x1][y1] == '.':
				counterD += 1
			counter += 1
			x1 += 1
			y1 -= 1
		if counterX == 2 and counterD == 1:
			return True
	if x - 2 >= 0 and y + 2 < 4:
		counter = counterX = counterD = 0
		(x1, y1) = (x, y)
		while counter < 3:
			if mylist[x1][y1] == 'x':
				counterX += 1
			elif mylist[x1][y1] == '.':
				counterD += 1
			counter += 1
			x1 -= 1
			y1 += 1
		if counterX == 2 and counterD == 1:
			return True
	if x - 2 >= 0 and y - 2 >= 0:
		counter = counterX = counterD = 0
		(x1, y1) = (x, y)
		while counter < 3:
			if mylist[x1][y1] == 'x':
				counterX += 1
			elif mylist[x1][y1] == '.':
				counterD += 1
			counter += 1
			x1 -= 1
			y1 -= 1
		if counterX == 2 and counterD == 1:
			return True
wrong = True
for i in range(len(mylist)):
	for j in range(len(mylist[i])):
		if mylist[i][j] == 'x':
			if validLeftOrRight(i, j) == True or validUpOrDown(i, j) == True or validDiagonal(i, j) == True:
				wrong = False
				break
print('YES' if wrong == False else 'NO')


def f(i, j):
	b = [a[i][:] for i in range(4)]
	if b[i][j] != '.':
		return 0
	b[i][j] = 'x'
	for i in range(4):
		for j in range(4):
			f1 = f2 = f3 = f4 = 1
			for k in range(3):
				if i + k >= 4 or j + k >= 4:
					f3 = 0
				elif b[i + k][j + k] != 'x':
					f3 = 0
				if i + k >= 4:
					f1 = 0
				elif b[i + k][j] != 'x':
					f1 = 0
				if j + k >= 4:
					f2 = 0
				elif b[i][j + k] != 'x':
					f2 = 0
				if i + k >= 4 or j - k < 0:
					f4 = 0
				elif b[i + k][j - k] != 'x':
					f4 = 0
			if f1 or f2 or f3 or f4:
				return 1
	return 0
a = [list(input()) for i in range(4)]
for i in range(4):
	for j in range(4):
		if f(i, j):
			print('YES')
			exit()
print('NO')


x = []
for i in range(4):
	x.append(list(input()))

def check(a, b):
	x[a][b] = 'x'
	for i in range(4):
		for j in range(2):
			if x[i][j] + x[i][j + 1] + x[i][j + 2] == 'xxx':
				return 'YES'
	for i in range(2):
		for j in range(4):
			if x[i][j] + x[i + 1][j] + x[i + 2][j] == 'xxx':
				return 'YES'
	if x[2][0] + x[1][1] + x[0][2] == 'xxx':
		return 'YES'
	if x[3][0] + x[2][1] + x[1][2] == 'xxx':
		return 'YES'
	if x[2][1] + x[1][2] + x[0][3] == 'xxx':
		return 'YES'
	if x[3][1] + x[2][2] + x[1][3] == 'xxx':
		return 'YES'
	if x[0][0] + x[1][1] + x[2][2] == 'xxx':
		return 'YES'
	if x[1][0] + x[2][1] + x[3][2] == 'xxx':
		return 'YES'
	if x[0][1] + x[1][2] + x[2][3] == 'xxx':
		return 'YES'
	if x[1][1] + x[2][2] + x[3][3] == 'xxx':
		return 'YES'
	return 'NO'
for i in range(4):
	for j in range(4):
		if x[i][j] == '.':
			if check(i, j) == 'YES':
				print('YES')
				quit()
			x[i][j] = '.'
else:
	print('NO')


def check(a):
	for i in range(4):
		if 'xxx' in a[i]:
			return True
	if a[1][0] == 'x' and a[2][0] == 'x' and (a[0][0] == 'x' or a[3][0] == 'x'):
		return True
	if a[1][1] == 'x' and a[2][1] == 'x' and (a[0][1] == 'x' or a[3][1] == 'x'):
		return True
	if a[1][2] == 'x' and a[2][2] == 'x' and (a[0][2] == 'x' or a[3][2] == 'x'):
		return True
	if a[1][3] == 'x' and a[2][3] == 'x' and (a[0][3] == 'x' or a[3][3] == 'x'):
		return True
	if a[0][2] == a[1][1] == a[2][0] == 'x':
		return True
	if a[1][2] == a[2][1] == 'x' and (a[3][0] == 'x' or a[0][3] == 'x'):
		return True
	if a[3][1] == a[2][2] == a[1][3] == 'x':
		return True
	if a[0][1] == a[1][2] == a[2][3] == 'x':
		return True
	if a[1][0] == a[2][1] == a[3][2] == 'x':
		return True
	if a[1][1] == a[2][2] == 'x' and (a[0][0] == 'x' or a[3][3] == 'x'):
		return True
	return False
(a, flag) = ([input() for i in range(4)], False)
for i in range(4):
	for j in range(4):
		if a[i][j] == '.':
			b = a[:]
			str = b[i]
			b[i] = str[:j] + 'x' + str[j + 1:]
			if check(b):
				flag = True
if flag:
	print('YES')
else:
	print('NO')


N = 4
board = [input() for _ in range(4)]
for i in range(N):
	for j in range(N):
		cand = []
		if j + 2 < N:
			cand.append([board[i][j + k] for k in range(3)])
		if i + 2 < N:
			cand.append([board[i + k][j] for k in range(3)])
		if i + 2 < N and j + 2 < N:
			cand.append([board[i + k][j + k] for k in range(3)])
		if i + 2 < N and j - 2 >= 0:
			cand.append([board[i + k][j - k] for k in range(3)])
		for row in cand:
			for k in range(3):
				if all((c == 'x' if i != k else c == '.' for (i, c) in enumerate(row))):
					print('YES')
					quit()
print('NO')


a = input()
b = input()
c = input()
d = input()
flag = 0
for x in range(0, 2):
	if a[x] == 'x' and a[x + 1] == 'x' and (a[x + 2] == '.') or (a[x] == '.' and a[x + 1] == 'x' and (a[x + 2] == 'x')) or (a[x] == 'x' and a[x + 1] == '.' and (a[x + 2] == 'x')):
		flag = 1
	elif b[x] == 'x' and b[x + 1] == 'x' and (b[x + 2] == '.') or (b[x] == '.' and b[x + 1] == 'x' and (b[x + 2] == 'x')) or (b[x] == 'x' and b[x + 1] == '.' and (b[x + 2] == 'x')):
		flag = 1
	elif c[x] == 'x' and c[x + 1] == 'x' and (c[x + 2] == '.') or (c[x] == '.' and c[x + 1] == 'x' and (c[x + 2] == 'x')) or (c[x] == 'x' and c[x + 1] == '.' and (c[x + 2] == 'x')):
		flag = 1
	elif d[x] == 'x' and d[x + 1] == 'x' and (d[x + 2] == '.') or (d[x] == 'x' and d[x + 1] == '.' and (d[x + 2] == 'x')) or (d[x] == 'x' and d[x + 1] == '.' and (d[x + 2] == 'x')):
		flag = 1
for x in range(0, 2):
	if a[x] == 'x' and b[x + 1] == 'x' and (c[x + 2] == '.') or (a[x] == 'x' and b[x + 1] == '.' and (c[x + 2] == 'x')) or (a[x] == '.' and b[x + 1] == 'x' and (c[x + 2] == 'x')):
		flag = 1
	if a[x + 2] == 'x' and b[x + 1] == 'x' and (c[x] == '.') or (a[x + 2] == 'x' and b[x + 1] == '.' and (c[x] == 'x')) or (a[x + 2] == '.' and b[x + 1] == 'x' and (c[x] == 'x')):
		flag = 1
	if b[x] == 'x' and c[x + 1] == 'x' and (d[x + 2] == '.') or (b[x] == 'x' and c[x + 1] == '.' and (d[x + 2] == 'x')) or (b[x] == '.' and c[x + 1] == 'x' and (d[x + 2] == 'x')):
		flag = 1
	if b[x + 2] == 'x' and c[x + 1] == 'x' and (d[x] == '.') or (b[x + 2] == 'x' and c[x + 1] == '.' and (d[x] == 'x')) or (b[x + 2] == '.' and c[x + 1] == 'x' and (d[x] == 'x')):
		flag = 1
for x in range(0, 4):
	if a[x] == 'x' and b[x] == 'x' and (c[x] == '.') or (a[x] == 'x' and b[x] == '.' and (c[x] == 'x')) or (a[x] == '.' and b[x] == 'x' and (c[x] == 'x')):
		flag = 1
	if d[x] == 'x' and b[x] == 'x' and (c[x] == '.') or (d[x] == 'x' and b[x] == '.' and (c[x] == 'x')) or (d[x] == '.' and b[x] == 'x' and (c[x] == 'x')):
		flag = 1
if flag == 1:
	print('YES')
else:
	print('NO')


n = 4
grid = []
for i in range(n):
	grid.append(list(input()))

def check_rows(grid):
	for i in range(len(grid)):
		for j in range(len(grid) - 2):
			sub = grid[i][j:j + 3]
			if sub.count('x') == 2 and sub.count('.') == 1:
				return True
	else:
		return False

def check_cols(grid):
	for i in range(len(grid)):
		for j in range(2):
			sub = []
			sub.append(grid[j][i])
			sub.append(grid[j + 1][i])
			sub.append(grid[j + 2][i])
			if sub.count('x') == 2 and sub.count('.') == 1:
				return True
	else:
		return False

def check_diag(grid):
	sub = []
	sub.append(grid[0][1])
	sub.append(grid[1][2])
	sub.append(grid[2][3])
	if sub.count('x') == 2 and sub.count('.') == 1:
		return True
	else:
		sub = []
		sub.append(grid[1][0])
		sub.append(grid[2][1])
		sub.append(grid[3][2])
		if sub.count('x') == 2 and sub.count('.') == 1:
			return True
	sub = []
	sub.append(grid[0][2])
	sub.append(grid[1][1])
	sub.append(grid[2][0])
	if sub.count('x') == 2 and sub.count('.') == 1:
		return True
	else:
		sub = []
		sub.append(grid[1][3])
		sub.append(grid[2][2])
		sub.append(grid[3][1])
		if sub.count('x') == 2 and sub.count('.') == 1:
			return True
	for i in range(len(grid) - 2):
		sub = []
		sub.append(grid[i][i])
		sub.append(grid[i + 1][i + 1])
		sub.append(grid[i + 2][i + 2])
		if sub.count('x') == 2 and sub.count('.') == 1:
			return True
	else:
		for i in range(len(grid) - 1, 1, -1):
			for j in range(len(grid) - 2):
				sub = []
				sub.append(grid[i][j])
				sub.append(grid[i - 1][j + 1])
				sub.append(grid[i - 2][j + 2])
				if sub.count('x') == 2 and sub.count('.') == 1:
					return True
		else:
			return False
if check_rows(grid):
	print('YES')
elif check_cols(grid):
	print('YES')
elif check_diag(grid):
	print('YES')
else:
	print('NO')


def main():
	m = [input() for _ in range(4)]
	m += list(zip(*m))
	m.append([m[i][i + 1] for i in range(3)])
	m.append([m[i][i] for i in range(4)])
	m.append([m[i + 1][i] for i in range(3)])
	m.append([m[i][2 - i] for i in range(3)])
	m.append([m[i][3 - i] for i in range(4)])
	m.append([m[i + 1][3 - i] for i in range(3)])
	for s in map(''.join, m):
		if any((p in s for p in ('.xx', 'x.x', 'xx.'))):
			print('YES')
			return
	print('NO')
main()


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from itertools import combinations, permutations
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
n = 4
arr = [ip() for i in range(n)]
for i in range(n):
	for j in range(n):
		if j + 3 <= n:
			c = 0
			for x in range(j, j + 3):
				if arr[i][x] == 'x':
					c += 1
				if arr[i][x] == 'o':
					c -= 1
			if c >= 2:
				exit(print('YES'))
		if i + 3 <= n:
			c = 0
			for x in range(i, i + 3):
				if arr[x][j] == 'x':
					c += 1
				if arr[x][j] == 'o':
					c -= 1
			if c >= 2:
				exit(print('YES'))
		if i + 3 <= n and j + 3 <= n:
			c = 0
			for x in range(3):
				if arr[i + x][j + x] == 'x':
					c += 1
				if arr[i + x][j + x] == 'o':
					c -= 1
			if c >= 2:
				exit(print('YES'))
		if i + 3 <= n and j - 2 >= 0:
			c = 0
			for x in range(3):
				if arr[i + x][j - x] == 'x':
					c += 1
				if arr[i + x][j - x] == 'o':
					c -= 1
			if c >= 2:
				exit(print('YES'))
print('NO')


def horizontal(arr, o, i):
	r = [arr[o][i], arr[o][i + 1], arr[o][i + 2]]
	l = [arr[o][i], arr[o][i - 1], arr[o][i - 2]]
	m = [arr[o][i - 1], arr[o][i], arr[o][i + 1]]
	all = [r, l, m]
	for (i, j, k) in all:
		if i == None or j == None or k == None or (i == 'o') or (j == 'o') or (k == 'o'):
			continue
		if i == j == '.' or i == k == '.' or j == k == '.':
			continue
		else:
			return 1
	return 0

def vertical(arr, o, i):
	r = [arr[o][i], arr[o + 1][i], arr[o + 2][i]]
	l = [arr[o][i], arr[o - 1][i], arr[o - 2][i]]
	m = [arr[o - 1][i], arr[o][i], arr[o + 1][i]]
	all = [r, l, m]
	for (i, j, k) in all:
		if i == None or j == None or k == None or (i == 'o') or (j == 'o') or (k == 'o'):
			continue
		if i == j == '.' or i == k == '.' or j == k == '.':
			continue
		else:
			return 1
	return 0

def leftDiagonal(arr, o, i):
	r = [arr[o][i], arr[o + 1][i + 1], arr[o + 2][i + 2]]
	l = [arr[o][i], arr[o - 1][i - 1], arr[o - 2][i - 2]]
	m = [arr[o - 1][i - 1], arr[o][i], arr[o + 1][i + 1]]
	all = [r, l, m]
	for (i, j, k) in all:
		if i == None or j == None or k == None or (i == 'o') or (j == 'o') or (k == 'o'):
			continue
		if i == j == '.' or i == k == '.' or j == k == '.':
			continue
		else:
			return 1
	return 0

def rightDiagonal(arr, o, i):
	r = [arr[o][i], arr[o + 1][i - 1], arr[o + 2][i - 2]]
	l = [arr[o][i], arr[o - 1][i + 1], arr[o - 2][i + 2]]
	m = [arr[o - 1][i + 1], arr[o][i], arr[o + 1][i - 1]]
	all = [r, l, m]
	for (i, j, k) in all:
		if i == None or j == None or k == None or (i == 'o') or (j == 'o') or (k == 'o'):
			continue
		if i == j == '.' or i == k == '.' or j == k == '.':
			continue
		else:
			return 1
	return 0

def solve(seq):
	outer = 2
	while outer < 6:
		inner = 2
		while inner < 6:
			if seq[outer][inner] == 'x':
				if horizontal(seq, outer, inner) == 1:
					return 'YES'
				elif vertical(seq, outer, inner) == 1:
					return 'YES'
				elif leftDiagonal(seq, outer, inner) == 1:
					return 'YES'
				elif rightDiagonal(seq, outer, inner) == 1:
					return 'YES'
			inner += 1
		outer += 1
	return 'NO'
seq = [[None] * 8] * 2
for x in range(4):
	n = [None, None]
	n.extend(list(input()))
	n.append(None)
	n.append(None)
	seq.append(n)
for y in range(2):
	seq.append([None] * 8)
print(solve(seq))


import itertools

class ListWithDefaultValue(list):

	def __init__(self, *args, **kwargs):
		self.def_value = kwargs.pop('def_value', '$')
		list.__init__(self, *args, **kwargs)

	def __getitem__(self, key):
		if 0 <= key < len(self):
			return list.__getitem__(self, key)
		else:
			return self.def_value
field = ListWithDefaultValue(def_value=ListWithDefaultValue(def_value='$'))
for i in range(4):
	field.append(ListWithDefaultValue(input(), def_value='$'))
for pos in itertools.product(range(4), repeat=2):
	(row, column) = pos
	if field[row][column] == 'x':
		for (d_row, d_column) in itertools.product(range(-1, 2), repeat=2):
			if (d_row, d_column) == (0, 0):
				continue
			else:
				first_val = field[row + d_row][column + d_column]
				second_val = field[row + 2 * d_row][column + 2 * d_column]
				if (first_val, second_val) in (('x', '.'), ('.', 'x')):
					print('YES')
					exit()
print('NO')
exit()


ttt = []
xs = []
mA = [-2, -2, -2, 0, 0, 2, 2, 2]
mB = [-2, 0, 2, -2, 2, -2, 0, 2]
mA2 = [-1, -1, -1, 0, 0, 1, 1, 1]
mB2 = [-1, 0, 1, -1, 1, -1, 0, 1]
for a in range(4):
	red = input()
	ttt.append(red)
	for b in range(4):
		if red[b] == 'x':
			xs.append([a, b])

def isFree(a, b):
	if a >= 0 and b >= 0 and (a <= 3) and (b <= 3):
		return 1
	else:
		return 0
sol = 'NO'
for pos in xs:
	pa = pos[0]
	pb = pos[1]
	for mo in range(8):
		pa1 = pa + mA[mo]
		pb1 = pb + mB[mo]
		if isFree(pa1, pb1):
			pa2 = pa + mA2[mo]
			pb2 = pb + mB2[mo]
			if ttt[pa2][pb2] == '.' and ttt[pa1][pb1] == 'x' or (ttt[pa2][pb2] == 'x' and ttt[pa1][pb1] == '.'):
				sol = 'YES'
				break
	if sol == 'YES':
		break
print(sol)


fields = []
fields.append([input() for i in range(4)])
fields.append(['' for i in range(4)])
for i in range(4):
	c = 0
	for j in fields[0][i]:
		fields[1][c] += j
		c += 1
line1 = ''
line2 = ''
for i in range(4):
	line1 += fields[0][i][i]
	line2 += fields[0][i][3 - i]
fields.append([line1, line2])
fields[2].append(fields[0][1][0] + fields[0][2][1] + fields[0][3][2])
fields[2].append(fields[0][0][1] + fields[0][1][2] + fields[0][2][3])
fields[2].append(fields[0][0][2] + fields[0][1][1] + fields[0][2][0])
fields[2].append(fields[0][1][3] + fields[0][2][2] + fields[0][3][1])
for i in fields:
	for j in i:
		if 'x.x' in j or '.xx' in j or 'xx.' in j:
			print('YES')
			return
print('NO')


a = list((list(input()) for i in range(4)))
t = 0
q = 2
w = 1
for i in range(2):
	for j in range(4):
		q = 2
		w = 1
		for k in range(3):
			if a[j][i + k] == 'x':
				q -= 1
			elif a[j][i + k] == '.':
				w -= 1
			else:
				q = 2
				w = 1
				break
		if q == 0 and w == 0:
			print('YES')
			exit()
		q = 2
		w = 1
for i in range(2):
	for j in range(4):
		q = 2
		w = 1
		for k in range(3):
			if a[i + k][j] == 'x':
				q -= 1
			elif a[i + k][j] == '.':
				w -= 1
			else:
				q = 2
				w = 1
				break
		if q == 0 and w == 0:
			print('YES')
			exit()
		q = 2
		w = 1
for i in range(2):
	for j in range(2):
		q = 2
		w = 1
		for k in range(3):
			if a[2 - k + j][k + i] == 'x':
				q -= 1
			elif a[2 - k + j][k + i] == '.':
				w -= 1
			else:
				q = 2
				w = 1
				break
		if q == 0 and w == 0:
			print('YES')
			exit()
		q = 2
		w = 1
for i in range(2):
	for j in range(2):
		q = 2
		w = 1
		for k in range(3):
			if a[k + j][k + i] == 'x':
				q -= 1
			elif a[k + j][k + i] == '.':
				w -= 1
			else:
				q = 2
				w = 1
				break
		if q == 0 and w == 0:
			print('YES')
			exit()
		q = 2
		w = 1
print('NO')


def retar():
	a = []
	s = str(input().strip())
	for i in s:
		a.append(i)
	return a
k = []
k.append(retar())
k.append(retar())
k.append(retar())
k.append(retar())

def mcell(x, y):
	try:
		if k[y][x] == 'x' and x >= 0 and (y >= 0):
			return True
		else:
			return False
	except:
		return False

def test(x, y):
	if k[y][x] == '.':
		if mcell(x - 1, y) and mcell(x + 1, y) or (mcell(x, y + 1) and mcell(x, y - 1)) or (mcell(x - 1, y + 1) and mcell(x + 1, y - 1)) or (mcell(x - 1, y - 1) and mcell(x + 1, y + 1)):
			return True
		if mcell(x - 1, y) and mcell(x - 2, y) or (mcell(x + 1, y) and mcell(x + 2, y)):
			return True
		if mcell(x, y + 1) and mcell(x, y + 2) or (mcell(x, y - 1) and mcell(x, y - 2)):
			return True
		if mcell(x - 1, y + 1) and mcell(x - 2, y + 2) or (mcell(x + 1, y + 1) and mcell(x + 2, y + 2)) or (mcell(x - 1, y - 1) and mcell(x - 2, y - 2)) or (mcell(x + 1, y - 1) and mcell(x + 2, y - 2)):
			return True
	else:
		return False
ress = 'NO'
for i in range(0, 4):
	for j in range(0, 4):
		if test(i, j):
			ress = 'YES'
			break
print(ress)


s1 = input()
s2 = input()
s3 = input()
s4 = input()
a = [['.' for x in range(4)] for _ in range(4)]
for i in range(4):
	for j in range(4):
		if i == 0:
			a[i][j] = s1[j]
		if i == 1:
			a[i][j] = s2[j]
		if i == 2:
			a[i][j] = s3[j]
		if i == 3:
			a[i][j] = s4[j]
n = 4
for i in range(4):
	for j in range(2):
		if a[i][j] != 'o' and a[i][j + 1] != 'o' and (a[i][j + 2] != 'o'):
			temp = []
			temp.append(a[i][j])
			temp.append(a[i][j + 1])
			temp.append(a[i][j + 2])
			temp = sorted(temp)
			if temp[1] != 'x':
				continue
			print('YES')
			exit()
for i in range(2):
	for j in range(4):
		if a[i][j] != 'o' and a[i + 1][j] != 'o' and (a[i + 2][j] != 'o'):
			temp = []
			temp.append(a[i][j])
			temp.append(a[i + 1][j])
			temp.append(a[i + 2][j])
			temp = sorted(temp)
			if temp[1] != 'x':
				continue
			print('YES')
			exit()
for i in range(2):
	for j in range(2):
		if a[i][j] != 'o' and a[i + 1][j + 1] != 'o' and (a[i + 2][j + 2] != 'o'):
			temp = []
			temp.append(a[i][j])
			temp.append(a[i + 1][j + 1])
			temp.append(a[i + 2][j + 2])
			temp = sorted(temp)
			if temp[1] != 'x':
				continue
			print('YES')
			exit()
for i in range(4):
	a[i] = a[i][::-1]
for i in range(4):
	for j in range(2):
		if a[i][j] != 'o' and a[i][j + 1] != 'o' and (a[i][j + 2] != 'o'):
			temp = []
			temp.append(a[i][j])
			temp.append(a[i][j + 1])
			temp.append(a[i][j + 2])
			temp = sorted(temp)
			if temp[1] != 'x':
				continue
			print('YES')
			exit()
for i in range(2):
	for j in range(4):
		if a[i][j] != 'o' and a[i + 1][j] != 'o' and (a[i + 2][j] != 'o'):
			temp = []
			temp.append(a[i][j])
			temp.append(a[i + 1][j])
			temp.append(a[i + 2][j])
			temp = sorted(temp)
			if temp[1] != 'x':
				continue
			print('YES')
			exit()
for i in range(2):
	for j in range(2):
		if a[i][j] != 'o' and a[i + 1][j + 1] != 'o' and (a[i + 2][j + 2] != 'o'):
			temp = []
			temp.append(a[i][j])
			temp.append(a[i + 1][j + 1])
			temp.append(a[i + 2][j + 2])
			temp = sorted(temp)
			if temp[1] != 'x':
				continue
			print('YES')
			exit()
print('NO')


def fct(l):
	for j in range(8):
		for p in range(8):
			if l[j][p] == '.':
				if check(j, p):
					return True
	return False

def check(j, p):
	a = 0
	b = 0
	c = 0
	d = 0
	if l[j + 1][p] == 'x':
		a += 1
		if l[j + 2][p] == 'x':
			a += 1
	if l[j - 1][p] == 'x':
		a += 1
		if l[j - 2][p] == 'x':
			a += 1
	if l[j - 1][p + 1] == 'x':
		b += 1
		if l[j - 2][p + 2] == 'x':
			b += 1
	if l[j + 1][p - 1] == 'x':
		b += 1
		if l[j + 2][p - 2] == 'x':
			b += 1
	if l[j][p + 1] == 'x':
		c += 1
		if l[j][p + 2] == 'x':
			c += 1
	if l[j][p - 1] == 'x':
		c += 1
		if l[j][p - 2] == 'x':
			c += 1
	if l[j + 1][p + 1] == 'x':
		d += 1
		if l[j + 2][p + 2] == 'x':
			d += 1
	if l[j - 1][p - 1] == 'x':
		d += 1
		if l[j - 2][p - 2] == 'x':
			d += 1
	if b > 1 or a > 1 or c > 1 or (d > 1):
		return True
	else:
		return False
l = []
l.append('########')
l.append('########')
for i in range(4):
	l.append('##' + input() + '##')
l.append('########')
l.append('########')
if fct(l):
	print('YES')
else:
	print('NO')


from operator import sub

def wins(next_tern):
	return left_X(next_tern) and right_X(next_tern) or (up_X(next_tern) and below_X(next_tern)) or (left_below_X(next_tern) and right_up_X(next_tern)) or (left_up_X(next_tern) and right_below_X(next_tern)) or right_right(next_tern) or left_left(next_tern) or up_up(next_tern) or below_below(next_tern) or ulul(next_tern) or urur(next_tern) or blbl(next_tern) or brbr(next_tern)

def ulul(next_tern):
	return left_up_X(next_tern) and has_X(2, 2, next_tern)

def urur(next_tern):
	return right_up_X(next_tern) and has_X(2, -2, next_tern)

def blbl(next_tern):
	return left_below_X(next_tern) and has_X(-2, 2, next_tern)

def brbr(next_tern):
	return right_below_X(next_tern) and has_X(-2, -2, next_tern)

def right_right(next_tern):
	return right_X(next_tern) and has_X(0, -2, next_tern)

def left_left(next_tern):
	return left_X(next_tern) and has_X(0, 2, next_tern)

def up_up(next_tern):
	return up_X(next_tern) and has_X(2, 0, next_tern)

def below_below(next_tern):
	return below_X(next_tern) and has_X(-2, 0, next_tern)

def left_X(next_tern):
	return has_X(0, 1, next_tern)

def up_X(next_tern):
	return has_X(1, 0, next_tern)

def right_X(next_tern):
	return has_X(0, -1, next_tern)

def below_X(next_tern):
	return has_X(-1, 0, next_tern)

def left_below_X(next_tern):
	return has_X(-1, 1, next_tern)

def right_up_X(next_tern):
	return has_X(1, -1, next_tern)

def right_below_X(next_tern):
	return has_X(-1, -1, next_tern)

def left_up_X(next_tern):
	return has_X(1, 1, next_tern)

def has_X(a, b, next_tern):
	a = next_tern[0] - a
	b = next_tern[1] - b
	return a in range(4) and b in range(4) and (layout[a][b] == 1)
layout = [[] for i in range(4)]
for i in range(4):
	ch = input()
	for j in range(4):
		if ch[j] == 'o':
			layout[i].append(2)
		elif ch[j] == 'x':
			layout[i].append(1)
		else:
			layout[i].append(0)
for i in range(4):
	for j in range(4):
		if layout[i][j] == 0 and wins((i, j)):
			print('YES')
			exit()
print('NO')


v = ['xx.', '.xx', 'x.x']
g = []
for i in range(4):
	g.append(input())
res = 'NO'
for i in range(4):
	if g[i][0] + g[i][1] + g[i][2] in v or g[i][1] + g[i][2] + g[i][3] in v:
		res = 'YES'
for i in range(4):
	if g[0][i] + g[1][i] + g[2][i] in v or g[1][i] + g[2][i] + g[3][i] in v:
		res = 'YES'
for i in range(1, 3):
	for j in range(1, 3):
		if g[i - 1][j - 1] + g[i][j] + g[i + 1][j + 1] in v or g[i - 1][j + 1] + g[i][j] + g[i + 1][j - 1] in v:
			res = 'YES'
print(res)


def checkwinning(a):
	for j in range(4):
		for i in range(2):
			xc = sum([a[u][j] == 'x' for u in range(i, i + 3)])
			dotc = sum([a[u][j] == '.' for u in range(i, i + 3)])
			if xc == 2 and dotc == 1:
				return True
	for i in range(4):
		for j in range(2):
			xc = sum([a[i][u] == 'x' for u in range(j, j + 3)])
			dotc = sum([a[i][u] == '.' for u in range(j, j + 3)])
			if xc == 2 and dotc == 1:
				return True
	for i in range(2):
		for j in range(2):
			xc = sum([a[i + k][j + k] == 'x' for k in range(3)])
			dotc = sum([a[i + k][j + k] == '.' for k in range(3)])
			if xc == 2 and dotc == 1:
				return True
	for i in range(2):
		for j in range(2, 4):
			xc = sum([a[i + k][j - k] == 'x' for k in range(3)])
			dotc = sum([a[i + k][j - k] == '.' for k in range(3)])
			if xc == 2 and dotc == 1:
				return True
a = []
for i in range(4):
	a.append(list(input().strip()))
if checkwinning(a):
	print('YES')
else:
	print('NO')


m = []
for i in range(4):
	m.append(input())
for i in range(4):
	s = ''
	for j in range(4):
		s += m[j][i]
	m.append(s)
for x in range(2):
	for y in range(2):
		s = ''
		for i in range(3):
			s += m[i + x][i + y]
		m.append(s)
for x in range(2):
	for y in range(2):
		s = ''
		for i in range(3):
			s += m[3 - i - x][i + y]
		m.append(s)
for i in m:
	if 'x.x' in i or 'xx.' in i or '.xx' in i:
		print('YES')
		break
else:
	print('NO')


s = []
response = 'NO'
for _ in range(4):
	s = s + [input()]
wins = ['xx.', 'x.x', '.xx', 'xxx']
for i in range(4):
	if s[i][1:] in wins or s[i][:3] in wins:
		response = 'YES'
	if i > 1:
		for j in range(4):
			if s[i - 2][j] + s[i - 1][j] + s[i][j] in wins:
				response = 'YES'
for i in range(1, 3):
	for j in range(1, 3):
		if s[i - 1][j - 1] + s[i][j] + s[i + 1][j + 1] in wins or s[i - 1][j + 1] + s[i][j] + s[i + 1][j - 1] in wins or s[i - 1][j + 1] + s[i][j] + s[i + 1][j - 1] in wins:
			response = 'YES'
print(response)


c = []
for i in range(4):
	s = input()
	c.append([])
	for j in range(4):
		c[i].append(s[j])
ans = 'NO'
for i in range(4):
	for j in range(4):
		if c[i][j] == '.':
			q = c[i][j]
			c[i][j] = 'x'
			for k in range(4):
				if c[k][0] == c[k][1] and c[k][0] == c[k][2] and (c[k][0] == 'x'):
					ans = 'YES'
				if c[k][1] == c[k][2] and c[k][1] == c[k][3] and (c[k][3] == 'x'):
					ans = 'YES'
			for k in range(4):
				if c[0][k] == c[1][k] and c[0][k] == c[2][k] and (c[2][k] == 'x'):
					ans = 'YES'
				if c[1][k] == c[2][k] and c[1][k] == c[3][k] and (c[3][k] == 'x'):
					ans = 'YES'
			if c[0][0] == c[1][1] and c[0][0] == c[2][2] and (c[0][0] == 'x'):
				ans = 'YES'
			if c[2][2] == c[1][1] and c[1][1] == c[3][3] and (c[2][2] == 'x'):
				ans = 'YES'
			if c[0][1] == c[1][2] and c[0][1] == c[2][3] and (c[0][1] == 'x'):
				ans = 'YES'
			if c[1][0] == c[2][1] and c[1][0] == c[3][2] and (c[1][0] == 'x'):
				ans = 'YES'
			if c[0][3] == c[1][2] and c[0][3] == c[2][1] and (c[0][3] == 'x'):
				ans = 'YES'
			if c[3][0] == c[2][1] and c[3][0] == c[1][2] and (c[1][2] == 'x'):
				ans = 'YES'
			if c[2][0] == c[1][1] and c[2][0] == c[0][2] and (c[0][2] == 'x'):
				ans = 'YES'
			if c[3][1] == c[2][2] and c[3][1] == c[1][3] and (c[1][3] == 'x'):
				ans = 'YES'
			c[i][j] = q
print(ans)


class GetOutOfLoop(Exception):
	pass
space = []
yes = False
for i in range(4):
	space.append([i for i in input()])
for i in range(4):
	for j in range(4):
		if space[i][j] == '.':
			newSpace = space
			newSpace[i][j] = 'x'
			for m in range(4):
				score = 0
				for n in range(4):
					if newSpace[m][n] == 'x':
						score += 1
						if score == 3:
							print('YES')
							yes = True
							break
					else:
						score = 0
			if yes:
				break
			for n in range(4):
				score = 0
				for m in range(4):
					if newSpace[m][n] == 'x':
						score += 1
						if score == 3:
							print('YES')
							yes = True
							break
					else:
						score = 0
			if yes:
				break
			if newSpace[0][1] == newSpace[1][2] == newSpace[2][3] == 'x':
				yes = True
				print('YES')
				break
			if newSpace[1][0] == newSpace[2][1] == newSpace[3][2] == 'x':
				yes = True
				print('YES')
				break
			if newSpace[2][0] == newSpace[1][1] == newSpace[0][2] == 'x':
				yes = True
				print('YES')
				break
			if newSpace[3][1] == newSpace[2][2] == newSpace[1][3] == 'x':
				yes = True
				print('YES')
				break
			if newSpace[0][0] == newSpace[1][1] == newSpace[2][2] == 'x':
				yes = True
				print('YES')
				break
			if newSpace[1][1] == newSpace[2][2] == newSpace[3][3] == 'x':
				yes = True
				print('YES')
				break
			if newSpace[3][0] == newSpace[2][1] == newSpace[1][2] == 'x':
				yes = True
				print('YES')
				break
			if newSpace[2][1] == newSpace[1][2] == newSpace[0][3] == 'x':
				yes = True
				print('YES')
				break
			newSpace[i][j] = '.'
		if yes:
			break
	if yes:
		break
if yes == False:
	print('NO')


def solve(A):
	for i in range(4):
		for j in range(4):
			if A[i][j] == '.':
				for (x, y) in ((-1, 0), (-1, 1), (0, 1), (1, 1)):
					if -1 < i + x < 4 and -1 < i - x < 4 and (-1 < j + y < 4) and (-1 < j - y < 4):
						if A[i + x][j + y] == 'x' and A[i - x][j - y] == 'x':
							return True
			if A[i][j] == 'x':
				for (x, y) in ((-1, 0), (-1, 1), (0, 1), (1, 1)):
					if -1 < i + x < 4 and -1 < i - x < 4 and (-1 < j + y < 4) and (-1 < j - y < 4):
						if A[i + x][j + y] == 'x' and A[i - x][j - y] == '.':
							return True
						if A[i + x][j + y] == '.' and A[i - x][j - y] == 'x':
							return True
	return False
A = [input().rstrip() for i in range(4)]
print('YES' if solve(A) else 'NO')


import sys
import math
import bisect

def solve():
	A = []
	for i in range(4):
		A.append(input())
	for i in range(4):
		for j in range(4):
			if i + 2 < 4:
				B = []
				B.append(A[i][j])
				B.append(A[i + 1][j])
				B.append(A[i + 2][j])
				if sorted(B) == sorted(['x', 'x', '.']):
					return True
			if j + 2 < 4:
				B = []
				B.append(A[i][j])
				B.append(A[i][j + 1])
				B.append(A[i][j + 2])
				if sorted(B) == sorted(['x', 'x', '.']):
					return True
			if i + 2 < 4 and j + 2 < 4:
				B = []
				B.append(A[i][j])
				B.append(A[i + 1][j + 1])
				B.append(A[i + 2][j + 2])
				if sorted(B) == sorted(['x', 'x', '.']):
					return True
			if i + 2 < 4 and j - 2 >= 0:
				B = []
				B.append(A[i][j])
				B.append(A[i + 1][j - 1])
				B.append(A[i + 2][j - 2])
				if sorted(B) == sorted(['x', 'x', '.']):
					return True
	return False

def main():
	if solve():
		print('YES')
	else:
		print('NO')
main()


arr = ['xx.', 'x.x', '.xx']
s = [input() for i in range(4)]
res = 'NO'
for i in range(4):
	a = s[i][0] + s[i][1] + s[i][2]
	b = s[i][1] + s[i][2] + s[i][3]
	if a in arr or b in arr:
		res = 'YES'
for j in range(4):
	a = s[0][j] + s[1][j] + s[2][j]
	b = s[1][j] + s[2][j] + s[3][j]
	if a in arr or b in arr:
		res = 'YES'
for i in range(1, 3):
	for j in range(1, 3):
		a = s[i - 1][j - 1] + s[i][j] + s[i + 1][j + 1]
		b = s[i - 1][j + 1] + s[i][j] + s[i + 1][j - 1]
		if a in arr or b in arr:
			res = 'YES'
print(res)


s1 = input()
s2 = input()
s3 = input()
s4 = input()
s5 = s1[0] + s2[0] + s3[0] + s4[0]
s6 = s1[1] + s2[1] + s3[1] + s4[1]
s7 = s1[2] + s2[2] + s3[2] + s4[2]
s8 = s1[3] + s2[3] + s3[3] + s4[3]
s = s1 + ' ' + s2 + ' ' + s3 + ' ' + s3 + ' ' + s4 + ' ' + s5 + ' ' + s6 + ' ' + s7 + ' ' + s8 + ' '
s = s + s1[0] + s2[1] + s3[2] + ' '
s = s + s1[2] + s2[1] + s3[0] + ' '
s = s + s1[1] + s2[2] + s3[3] + ' '
s = s + s1[3] + s2[2] + s3[1] + ' '
s = s + s2[0] + s3[1] + s4[2] + ' '
s = s + s2[2] + s3[1] + s4[0] + ' '
s = s + s2[1] + s3[2] + s4[3] + ' '
s = s + s2[3] + s3[2] + s4[1] + ' '
a = 'x.x'
b = 'xx.'
c = '.xx'
if s.find(a) != -1 or s.find(b) != -1 or s.find(c) != -1:
	print('YES')
else:
	print('NO')


a = []
for i in range(4):
	a += [input()]
f = False
for i in range(4):
	for j in range(2):
		f |= a[i][j:j + 3].count('.') == 1 and a[i][j:j + 3].count('o') == 0
for j in range(4):
	for i in range(2):
		f |= ([a[i][j]] + [a[i + 1][j]] + [a[i + 2][j]]).count('.') == 1 and ([a[i][j]] + [a[i + 1][j]] + [a[i + 2][j]]).count('o') == 0
for i in range(2):
	for j in range(2):
		f |= [a[i][j], a[i + 1][j + 1], a[i + 2][j + 2]].count('.') == 1 and [a[i][j], a[i + 1][j + 1], a[i + 2][j + 2]].count('o') == 0
		f |= [a[3 - i][j], a[2 - i][j + 1], a[1 - i][j + 2]].count('.') == 1 and [a[3 - i][j], a[2 - i][j + 1], a[1 - i][j + 2]].count('o') == 0
if f:
	print('YES')
else:
	print('NO')


from sys import exit
l1 = input()
l2 = input()
l3 = input()
l4 = input()
grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
cross = 0
dots = []
for i in range(0, 4):
	if l1[i] == '.':
		dots += [[0 + 2, i + 2]]
	elif l1[i] == 'x':
		cross += 1
		grid[0 + 2][i + 2] = 1
	if l2[i] == '.':
		dots += [[1 + 2, i + 2]]
	elif l2[i] == 'x':
		cross += 1
		grid[1 + 2][i + 2] = 1
	if l3[i] == '.':
		dots += [[2 + 2, i + 2]]
	elif l3[i] == 'x':
		cross += 1
		grid[2 + 2][i + 2] = 1
	if l4[i] == '.':
		dots += [[3 + 2, i + 2]]
	elif l4[i] == 'x':
		cross += 1
		grid[3 + 2][i + 2] = 1

def check(dot, dir, delta):
	global grid
	grid[dot[0]][dot[1]] = 1
	acc = 1
	if dir == 0:
		for i in range(delta, delta + 3):
			acc *= grid[dot[0] + i][dot[1]]
	elif dir == 1:
		for i in range(delta, delta + 3):
			acc *= grid[dot[0]][dot[1] + i]
	elif dir == 2:
		for i in range(delta, delta + 3):
			acc *= grid[dot[0] + i][dot[1] + i]
	elif dir == 3:
		for i in range(delta, delta + 3):
			acc *= grid[dot[0] + i][dot[1] - i]
	grid[dot[0]][dot[1]] = 0
	return acc
if cross < 2 or len(dots) == 0:
	print('NO')
else:
	for dot in dots:
		for dir in range(0, 4):
			for delta in range(-2, 1):
				if check(dot, dir, delta) == 1:
					print('YES')
					exit(0)
print('NO')


bord = [input() for _ in range(4)]
s = [(bord[0][2], bord[1][1], bord[2][0]), (bord[0][3], bord[1][2], bord[2][1]), (bord[1][2], bord[2][1], bord[3][0]), (bord[1][3], bord[2][2], bord[3][1]), (bord[0][0], bord[1][1], bord[2][2]), (bord[1][1], bord[2][2], bord[3][3]), (bord[1][0], bord[2][1], bord[3][2]), (bord[0][1], bord[1][2], bord[2][3])]
for i in bord:
	s.append((i[0], i[1], i[2]))
	s.append((i[1], i[2], i[3]))
diffrent_bord = ['', '', '', '']
for j in range(4):
	for k in range(4):
		diffrent_bord[k] += bord[j][k]
for i in diffrent_bord:
	s.append((i[0], i[1], i[2]))
	s.append((i[1], i[2], i[3]))
if {('.', 'x', 'x'), ('x', 'x', '.'), ('x', '.', 'x')} & set(s):
	print('YES')
else:
	print('NO')


s = []
for i in range(4):
	s1 = input()
	s.append(s1)
a = set()
for i in range(4):
	s1 = s[i][0:3]
	s2 = s[i][1:4]
	s3 = s[0][i] + s[1][i] + s[2][i]
	s4 = s[1][i] + s[2][i] + s[3][i]
	a.add(s1)
	a.add(s2)
	a.add(s3)
	a.add(s4)
for i in range(0, 2):
	for j in range(2):
		a.add(s[i][j] + s[i + 1][j + 1] + s[i + 2][j + 2])
		a.add(s[i][3 - j] + s[i + 1][2 - j] + s[i + 2][1 - j])
s1 = 'xx.'
s2 = 'x.x'
s3 = '.xx'
if s1 in a or s2 in a or s3 in a:
	print('YES')
else:
	print('NO')


r1 = input()
r2 = input()
r3 = input()
r4 = input()
c1 = r1[0] + r2[0] + r3[0] + r4[0]
c2 = r1[1] + r2[1] + r3[1] + r4[1]
c3 = r1[2] + r2[2] + r3[2] + r4[2]
c4 = r1[3] + r2[3] + r3[3] + r4[3]
d1 = r1[0] + r2[1] + r3[2]
d2 = r1[1] + r2[2] + r3[3]
d3 = r1[2] + r2[1] + r3[0]
d4 = r1[3] + r2[2] + r3[1]
d5 = r2[0] + r3[1] + r4[2]
d6 = r2[1] + r3[2] + r4[3]
d7 = r2[2] + r3[1] + r4[0]
d8 = r2[3] + r3[2] + r4[1]
chk = [r1, r2, r3, r4, c1, c2, c3, c4, d1, d2, d3, d4, d5, d6, d7, d8]
for i in chk:
	if '.xx' in i or 'xx.' in i or 'x.x' in i:
		print('YES')
		break
else:
	print('NO')


import sys
board = []
while True:
	w = sys.stdin.readline().strip()
	if not w:
		break
	for i in range(0, 2):
		if w[i] == '.' and w[i + 1] == 'x' and (w[i + 2] == 'x') or (w[i] == 'x' and w[i + 1] == 'x' and (w[i + 2] == '.')) or (w[i] == 'x' and w[i + 1] == '.' and (w[i + 2] == 'x')):
			print('YES')
			exit()
	board.append(w)
for i in range(0, 2):
	for j in range(0, 4):
		if board[i][j] == '.' and board[i + 1][j] == 'x' and (board[i + 2][j] == 'x') or (board[i][j] == 'x' and board[i + 1][j] == 'x' and (board[i + 2][j] == '.')) or (board[i][j] == 'x' and board[i + 1][j] == '.' and (board[i + 2][j] == 'x')):
			print('YES')
			exit()
for i in range(0, 2):
	for j in range(0, 2):
		if board[i][j] == '.' and board[i + 1][j + 1] == 'x' and (board[i + 2][j + 2] == 'x') or (board[i][j] == 'x' and board[i + 1][j + 1] == 'x' and (board[i + 2][j + 2] == '.')) or (board[i][j] == 'x' and board[i + 1][j + 1] == '.' and (board[i + 2][j + 2] == 'x')):
			print('YES')
			exit()
for i in range(0, 2):
	for j in range(2, 4):
		if board[i][j] == '.' and board[i + 1][j - 1] == 'x' and (board[i + 2][j - 2] == 'x') or (board[i][j] == 'x' and board[i + 1][j - 1] == 'x' and (board[i + 2][j - 2] == '.')) or (board[i][j] == 'x' and board[i + 1][j - 1] == '.' and (board[i + 2][j - 2] == 'x')):
			print('YES')
			exit()
print('NO')


m = []
m.append('######')
m.append('######')
m += [input() + '##' for i in range(4)]
m.append('######')
m.append('######')
cool = ['xx.', 'x.x', '.xx']
for i in range(2, 6):
	for j in range(0, 4):
		if m[i][j] + m[i][j + 1] + m[i][j + 2] in cool or m[i][j] + m[i + 1][j] + m[i + 2][j] in cool or m[i][j] + m[i + 1][j + 1] + m[i + 2][j + 2] in cool or (m[i][j] + m[i - 1][j + 1] + m[i - 2][j + 2] in cool):
			print('YES')
			exit()
print('NO')


a = [0] * 4
for i in range(4):
	a[i] = input()
t = False
for i in range(4):
	q1 = [a[0][i], a[1][i], a[2][i]]
	q2 = [a[1][i], a[2][i], a[3][i]]
	if q1.count('x') == 2 and q1.count('.') == 1 or (q2.count('x') == 2 and q2.count('.') == 1):
		t = True
for i in range(4):
	q3 = [a[i][0], a[i][1], a[i][2]]
	q4 = [a[i][1], a[i][2], a[i][3]]
	if q3.count('x') == 2 and q3.count('.') == 1 or (q4.count('x') == 2 and q4.count('.') == 1):
		t = True
q1 = [a[0][1], a[1][2], a[2][3]]
q2 = [a[1][0], a[2][1], a[3][2]]
q3 = [a[2][0], a[1][1], a[0][2]]
q4 = [a[3][1], a[2][2], a[1][3]]
if q3.count('x') == 2 and q3.count('.') == 1 or (q4.count('x') == 2 and q4.count('.') == 1):
	t = True
if q1.count('x') == 2 and q1.count('.') == 1 or (q2.count('x') == 2 and q2.count('.') == 1):
	t = True
q1 = [a[0][0], a[1][1], a[2][2]]
q2 = [a[1][1], a[2][2], a[3][3]]
q3 = [a[3][0], a[2][1], a[1][2]]
q4 = [a[2][1], a[1][2], a[0][3]]
if q3.count('x') == 2 and q3.count('.') == 1 or (q4.count('x') == 2 and q4.count('.') == 1):
	t = True
if q1.count('x') == 2 and q1.count('.') == 1 or (q2.count('x') == 2 and q2.count('.') == 1):
	t = True
if t:
	print('YES')
else:
	print('NO')


a = [[0] * 4 for i in range(4)]
for i in range(4):
	s = input()
	for j in range(4):
		if s[j] == 'x':
			a[i][j] = 1
		elif s[j] == 'o':
			a[i][j] = -1
o = 0
for i in range(4):
	if o == 0:
		for j in range(4):
			if a[i][j] == 1:
				if j < 2:
					z = 0
					for k in range(1, 3):
						if a[i][j + k] == -1:
							break
						elif a[i][j + k] == 1:
							z += 1
					else:
						if z == 1:
							o = 1
							print('YES')
							break
				if i < 2:
					z = 0
					for k in range(1, 3):
						if a[i + k][j] == -1:
							break
						elif a[i + k][j] == 1:
							z += 1
					else:
						if z == 1:
							o = 1
							print('YES')
							break
				if j < 2 and i < 2:
					z = 0
					for k in range(1, 3):
						if a[i + k][j + k] == -1:
							break
						elif a[i + k][j + k] == 1:
							z += 1
					else:
						if z == 1:
							o = 1
							print('YES')
							break
				if j > 1 and i < 2:
					z = 0
					for k in range(1, 3):
						if a[i + k][j - k] == -1:
							break
						elif a[i + k][j - k] == 1:
							z += 1
					else:
						if z == 1:
							o = 1
							print('YES')
							break
			elif a[i][j] == 0:
				if j < 2:
					z = 0
					for k in range(1, 3):
						if a[i][j + k] == -1:
							break
						elif a[i][j + k] == 1:
							z += 1
					else:
						if z == 2:
							o = 1
							print('YES')
							break
				if i < 2:
					z = 0
					for k in range(1, 3):
						if a[i + k][j] == -1:
							break
						elif a[i + k][j] == 1:
							z += 1
					else:
						if z == 2:
							o = 1
							print('YES')
							break
				if j < 2 and i < 2:
					z = 0
					for k in range(1, 3):
						if a[i + k][j + k] == -1:
							break
						elif a[i + k][j + k] == 1:
							z += 1
					else:
						if z == 2:
							o = 1
							print('YES')
							break
				if j > 1 and i < 2:
					z = 0
					for k in range(1, 3):
						if a[i + k][j - k] == -1:
							break
						elif a[i + k][j - k] == 1:
							z += 1
					else:
						if z == 2:
							o = 1
							print('YES')
							break
	else:
		break
else:
	if o == 0:
		print('NO')


gor1 = input()
gor2 = input()
gor3 = input()
gor4 = input()
vert1 = gor1[0] + gor2[0] + gor3[0] + gor4[0]
vert2 = gor1[1] + gor2[1] + gor3[1] + gor4[1]
vert3 = gor1[2] + gor2[2] + gor3[2] + gor4[2]
vert4 = gor1[3] + gor2[3] + gor3[3] + gor4[3]
diag1 = gor1[0] + gor2[1] + gor3[2] + gor4[3]
diag2 = gor1[3] + gor2[2] + gor3[1] + gor4[0]
diag3 = gor1[1] + gor2[2] + gor3[3]
diag4 = gor2[0] + gor3[1] + gor4[2]
diag5 = gor1[2] + gor2[1] + gor3[0]
diag6 = gor2[3] + gor3[2] + gor4[1]
if 'xx.' in gor1 or 'xx.' in gor2 or 'xx.' in gor3 or ('xx.' in gor4) or ('.xx' in gor1) or ('.xx' in gor2) or ('.xx' in gor3) or ('.xx' in gor4) or ('x.x' in gor1) or ('x.x' in gor2) or ('x.x' in gor3) or ('x.x' in gor4):
	print('YES')
elif 'xx.' in vert1 or 'xx.' in vert2 or 'xx.' in vert3 or ('xx.' in vert4) or ('.xx' in vert1) or ('.xx' in vert2) or ('.xx' in vert3) or ('.xx' in vert4) or ('x.x' in vert1) or ('x.x' in vert2) or ('x.x' in vert3) or ('x.x' in vert4):
	print('YES')
elif 'xx.' in diag1 or 'xx.' in diag2 or 'xx.' in diag3 or ('xx.' in diag4) or ('xx.' in diag5) or ('xx.' in diag6) or ('.xx' in diag1) or ('.xx' in diag2) or ('.xx' in diag3) or ('.xx' in diag4) or ('.xx' in diag5) or ('.xx' in diag6) or ('x.x' in diag1) or ('x.x' in diag2) or ('x.x' in diag3) or ('x.x' in diag4) or ('x.x' in diag5) or ('x.x' in diag6):
	print('YES')
else:
	print('NO')


d_x = [0, 1, 1, 1]
d_y = [-1, -1, 1, 0]
l_p = list()
for _ in range(4):
	l_p.append(list(input()))
for x in range(4):
	for y in range(4):
		if l_p[y][x] != 'o':
			for i in range(len(d_x)):
				if y + d_y[i] * 2 < 4 and y + d_y[i] * 2 >= 0 and (x + d_x[i] * 2 < 4) and (x + d_x[i] * 2 >= 0):
					b = True
					c_p = 0
					for j in range(3):
						if l_p[y + d_y[i] * j][x + d_x[i] * j] == '.' and c_p == 0:
							c_p = 1
						elif l_p[y + d_y[i] * j][x + d_x[i] * j] == 'o' or (c_p == 1 and l_p[y + d_y[i] * j][x + d_x[i] * j] == '.'):
							b = False
							break
					if b:
						print('YES')
						quit()
				else:
					pass
print('NO')


arr = []
for i in range(4):
	s = str(input())
	arr1 = []
	for i in s:
		arr1.append(i)
	arr.append(arr1)
for i in range(4):
	for j in range(4):
		if i <= 1 and j <= 1:
			countx = 0
			countdot = 0
			if arr[i][j] == 'x':
				countx += 1
			elif arr[i][j] == '.':
				countdot += 1
			if arr[i + 1][j + 1] == 'x':
				countx += 1
			elif arr[i + 1][j + 1] == '.':
				countdot += 1
			if arr[i + 2][j + 2] == 'x':
				countx += 1
			elif arr[i + 2][j + 2] == '.':
				countdot += 1
			if countx == 2 and countdot == 1:
				print('YES')
				exit(0)
		if i <= 1:
			countx = 0
			countdot = 0
			if arr[i][j] == 'x':
				countx += 1
			elif arr[i][j] == '.':
				countdot += 1
			if arr[i + 1][j] == 'x':
				countx += 1
			elif arr[i + 1][j] == '.':
				countdot += 1
			if arr[i + 2][j] == 'x':
				countx += 1
			elif arr[i + 2][j] == '.':
				countdot += 1
			if countx == 2 and countdot == 1:
				print('YES')
				exit(0)
		if j <= 1:
			countx = 0
			countdot = 0
			if arr[i][j] == 'x':
				countx += 1
			elif arr[i][j] == '.':
				countdot += 1
			if arr[i][j + 1] == 'x':
				countx += 1
			elif arr[i][j + 1] == '.':
				countdot += 1
			if arr[i][j + 2] == 'x':
				countx += 1
			elif arr[i][j + 2] == '.':
				countdot += 1
			if countx == 2 and countdot == 1:
				print('YES')
				exit(0)
		if i <= 1 and j >= 2:
			countx = 0
			countdot = 0
			if arr[i][j] == 'x':
				countx += 1
			elif arr[i][j] == '.':
				countdot += 1
			if arr[i + 1][j - 1] == 'x':
				countx += 1
			elif arr[i + 1][j - 1] == '.':
				countdot += 1
			if arr[i + 2][j - 2] == 'x':
				countx += 1
			elif arr[i + 2][j - 2] == '.':
				countdot += 1
			if countx == 2 and countdot == 1:
				print('YES')
				exit(0)
print('NO')


def check(board):
	for i in range(4):
		for j in range(2):
			if board[i][j] == board[i][j + 1] == board[i][j + 2] == 'x':
				return True
	for i in range(2):
		for j in range(4):
			if board[i][j] == board[i + 1][j] == board[i + 2][j] == 'x':
				return True
	for i in range(2):
		for j in range(2):
			if board[i][j] == board[i + 1][j + 1] == board[i + 2][j + 2] == 'x':
				return True
	for i in range(2):
		for j in range(2, 4):
			if board[i][j] == board[i + 1][j - 1] == board[i + 2][j - 2] == 'x':
				return True
	return False
board = []
for _ in range(4):
	board.append(input())
possible = False
for i in range(4):
	for j in range(4):
		if board[i][j] == '.':
			board[i] = board[i][:j] + 'x' + board[i][j + 1:]
			if check(board):
				possible = True
			board[i] = board[i][:j] + '.' + board[i][j + 1:]
print('YES' if possible else 'NO')


import itertools
field = []
for i in range(4):
	field.append(input())
for pos in itertools.product(range(4), repeat=2):
	(row, column) = pos
	if field[row][column] == 'x':
		for (d_row, d_column) in itertools.product(range(-1, 2), repeat=2):
			if (d_row, d_column) == (0, 0):
				continue
			elif not 0 <= row + 2 * d_row < 4:
				continue
			elif not 0 <= column + 2 * d_column < 4:
				continue
			else:
				first_val = field[row + d_row][column + d_column]
				second_val = field[row + 2 * d_row][column + 2 * d_column]
				if (first_val, second_val) in (('x', '.'), ('.', 'x')):
					print('YES')
					exit()
print('NO')
exit()


l = []
for i in range(4):
	l.append(list(input()))
score = 'NO'
m = []
m.append(['o'] * 8)
m.append(['o'] * 8)
for i in range(4):
	m.append(['o'] * 2 + l[i] + ['o'] * 2)
m.append(['o'] * 8)
m.append(['o'] * 8)

def check(i, j):
	i += 2
	j += 2
	if m[i][j + 1] == 'x' and m[i][j + 2] == '.' or (m[i][j + 2] == 'x' and m[i][j + 1] == '.'):
		return 'YES'
	if m[i][j - 1] == 'x' and m[i][j - 2] == '.' or (m[i][j - 2] == 'x' and m[i][j - 1] == '.'):
		return 'YES'
	if m[i + 1][j] == 'x' and m[i + 2][j] == '.' or (m[i + 2][j] == 'x' and m[i + 1][j] == '.'):
		return 'YES'
	if m[i - 1][j] == 'x' and m[i - 2][j] == '.' or (m[i - 2][j] == 'x' and m[i - 1][j] == '.'):
		return 'YES'
	if m[i + 1][j + 1] == 'x' and m[i + 2][j + 2] == '.' or (m[i + 2][j + 2] == 'x' and m[i + 1][j + 1] == '.'):
		return 'YES'
	if m[i - 1][j - 1] == 'x' and m[i - 2][j - 2] == '.' or (m[i - 2][j - 2] == 'x' and m[i - 1][j - 1] == '.'):
		return 'YES'
	if m[i - 1][j + 1] == 'x' and m[i - 2][j + 2] == '.' or (m[i - 2][j + 2] == 'x' and m[i - 1][j + 1] == '.'):
		return 'YES'
	if m[i + 1][j - 1] == 'x' and m[i + 2][j - 2] == '.' or (m[i + 2][j - 2] == 'x' and m[i + 1][j - 1] == '.'):
		return 'YES'
	return 'NO'
for i in range(4):
	for j in range(4):
		if l[i][j] == 'x':
			score = check(i, j)
			if score == 'YES':
				break
	if score == 'YES':
		break
print(score)


ttt = list()
for i in range(4):
	row = input()
	if '.xx' in row or 'xx.' in row or 'x.x' in row:
		print('YES')
		quit()
	ttt.append(row)
for i in range(4):
	col = ''
	for j in range(4):
		col += ttt[j][i]
	if '.xx' in col or 'xx.' in col or 'x.x' in col:
		print('YES')
		quit()
for i in range(6):
	if i == 0:
		diag = ttt[1][0] + ttt[2][1] + ttt[3][2]
	elif i == 1:
		diag = ttt[0][1] + ttt[1][2] + ttt[2][3]
	elif i == 2:
		diag = ttt[0][2] + ttt[1][1] + ttt[2][0]
	elif i == 3:
		diag = ttt[1][3] + ttt[2][2] + ttt[3][1]
	elif i == 4:
		diag = ttt[0][0] + ttt[1][1] + ttt[2][2] + ttt[3][3]
	else:
		diag = ttt[0][3] + ttt[1][2] + ttt[2][1] + ttt[3][0]
	if 'xx.' in diag or '.xx' in diag or 'x.x' in diag:
		print('YES')
		quit()
print('NO')


def proof(array):
	answer = False
	for i in range(4):
		for j in range(2):
			if 'x' == array[i][j] == array[i][j + 1] == array[i][j + 2]:
				answer = True
	for i in range(4):
		for j in range(2, 4):
			if 'x' == array[i][j] == array[i][j - 1] == array[i][j - 2]:
				answer = True
	for i in range(2):
		for j in range(4):
			if 'x' == array[i][j] == array[i + 1][j] == array[i + 2][j]:
				answer = True
	for i in range(2, 4):
		for j in range(4):
			if 'x' == array[i][j] == array[i - 1][j] == array[i - 2][j]:
				answer = True
	for i in range(2):
		for j in range(2):
			if 'x' == array[i][j] == array[i + 1][j + 1] == array[i + 2][j + 2]:
				answer = True
	for i in range(2, 4):
		for j in range(2):
			if 'x' == array[i][j] == array[i - 1][j + 1] == array[i - 2][j + 2]:
				answer = True
	for i in range(2):
		for j in range(2, 4):
			if 'x' == array[i][j] == array[i + 1][j - 1] == array[i + 2][j - 2]:
				answer = True
	for i in range(2, 4):
		for j in range(2, 4):
			if 'x' == array[i][j] == array[i - 1][j - 1] == array[i - 2][j - 2]:
				answer = True
	return answer
array = []
for i in range(4):
	str = input()
	array.append([])
	for j in range(4):
		array[i].append(str[j])
ans = False
for i in range(4):
	for j in range(4):
		if array[i][j] == '.':
			array[i][j] = 'x'
			ans = proof(array)
			array[i][j] = '.'
		if ans:
			break
	if ans:
		break
if ans:
	print('YES')
else:
	print('NO')


def verify(x):
	won = 0
	for row in x:
		won += 'xxx' in row
	xt = [''.join([line[i] for line in x]) for i in range(4)]
	for col in xt:
		won += 'xxx' in col
	for mat in [x, [line[::-1] for line in x]]:
		won += 'xxx' in mat[0][0] + mat[1][1] + mat[2][2] + mat[3][3]
		won += 'xxx' in mat[0][1] + mat[1][2] + mat[2][3]
		won += 'xxx' in mat[1][0] + mat[2][1] + mat[3][2]
	return won

def split_in_rows(x):
	return [x[i:i + 4] for i in range(0, len(x), 4)]
nlines = 4
lines = list()
for _ in range(nlines):
	lines.append(input())
lines = ''.join(lines)
won = 0
i = 0
while won == 0 and i < len(lines):
	if lines[i] == '.':
		won += verify(split_in_rows(lines[:i] + 'x' + lines[i + 1:]))
	i += 1
if won > 0:
	print('YES')
else:
	print('NO')


IL = lambda : list(map(int, input().split()))
IS = lambda : input().split()
I = lambda : int(input())
S = lambda : input()

def sub3(s):
	return [s[i:][:3] for i in range(len(s) - 2)]
grid = [list(S()) for i in range(4)]
choices = []
for row in grid:
	choices += sub3(row)
for i in range(4):
	choices += sub3([grid[j][i] for j in range(4)])
choices += sub3(grid[0][0] + grid[1][1] + grid[2][2] + grid[3][3])
choices += sub3(grid[0][3] + grid[1][2] + grid[2][1] + grid[3][0])
choices.append(grid[0][1] + grid[1][2] + grid[2][3])
choices.append(grid[0][2] + grid[1][1] + grid[2][0])
choices.append(grid[1][0] + grid[2][1] + grid[3][2])
choices.append(grid[1][3] + grid[2][2] + grid[3][1])
choices = [sorted(c) for c in choices]
print('YES' if list('.xx') in choices else 'NO')


def func(arr):
	for i in range(4):
		for j in range(2):
			countdot = countx = 0
			if arr[i][j] == 'x':
				countx += 1
			elif arr[i][j] == '.':
				countdot += 1
			if arr[i][j + 1] == 'x':
				countx += 1
			elif arr[i][j + 1] == '.':
				countdot += 1
			if arr[i][j + 2] == 'x':
				countx += 1
			elif arr[i][j + 2] == '.':
				countdot += 1
			if countx == 2 and countdot == 1:
				return True
	for i in range(2):
		for j in range(4):
			countdot = countx = 0
			if arr[i][j] == 'x':
				countx += 1
			elif arr[i][j] == '.':
				countdot += 1
			if arr[i + 1][j] == 'x':
				countx += 1
			elif arr[i + 1][j] == '.':
				countdot += 1
			if arr[i + 2][j] == 'x':
				countx += 1
			elif arr[i + 2][j] == '.':
				countdot += 1
			if countx == 2 and countdot == 1:
				return True

def func2(arr):
	lst = [[[0, 0], [1, 1], [2, 2]], [[0, 1], [1, 2], [2, 3]], [[0, 2], [1, 1], [2, 0]], [[0, 3], [1, 2], [2, 1]], [[3, 0], [2, 1], [1, 2]], [[3, 1], [2, 2], [1, 3]], [[3, 2], [2, 1], [1, 0]], [[3, 3], [2, 2], [1, 1]]]
	for i in lst:
		countdot = countx = 0
		for (j, k) in i:
			if arr[j][k] == 'x':
				countx += 1
			elif arr[j][k] == '.':
				countdot += 1
		if countdot == 1 and countx == 2:
			return True
arr = []
for i in range(4):
	t = input()
	arr.append(t)
if func(arr):
	print('YES')
elif func2(arr):
	print('YES')
else:
	print('NO')


s1 = input()
s2 = input()
s3 = input()
s4 = input()
s5 = s1[0] + s2[0] + s3[0] + s4[0]
s6 = s1[1] + s2[1] + s3[1] + s4[1]
s7 = s1[2] + s2[2] + s3[2] + s4[2]
s8 = s1[3] + s2[3] + s3[3] + s4[3]
s9 = s2[0] + s3[1] + s4[2]
s10 = s1[0] + s2[1] + s3[2] + s4[3]
s11 = s1[1] + s2[2] + s3[3]
s12 = s1[2] + s2[1] + s3[0]
s13 = s1[3] + s2[2] + s3[1] + s4[0]
s14 = s2[3] + s3[2] + s4[1]
f = False
if 'xx.' in s1 or 'xx.' in s2 or 'xx.' in s3 or ('xx.' in s4) or ('xx.' in s5) or ('xx.' in s6) or ('xx.' in s7) or ('xx.' in s8) or ('xx.' in s9) or ('xx.' in s10) or ('xx.' in s11) or ('xx.' in s12) or ('xx.' in s13) or ('xx.' in s14):
	f = True
if 'x.x' in s1 or 'x.x' in s2 or 'x.x' in s3 or ('x.x' in s4) or ('x.x' in s5) or ('x.x' in s6) or ('x.x' in s7) or ('x.x' in s8) or ('x.x' in s9) or ('x.x' in s10) or ('x.x' in s11) or ('x.x' in s12) or ('x.x' in s13) or ('x.x' in s14):
	f = True
if '.xx' in s1 or '.xx' in s2 or '.xx' in s3 or ('.xx' in s4) or ('.xx' in s5) or ('.xx' in s6) or ('.xx' in s7) or ('.xx' in s8) or ('.xx' in s9) or ('.xx' in s10) or ('.xx' in s11) or ('.xx' in s12) or ('.xx' in s13) or ('.xx' in s14):
	f = True
if f:
	print('YES')
else:
	print('NO')


def solve():
	lines = [input() for _ in range(4)]
	patterns = [[(0, 0), (0, 1), (0, 2)], [(0, 1), (0, 2), (0, 3)], [(1, 0), (1, 1), (1, 2)], [(1, 1), (1, 2), (1, 3)], [(2, 0), (2, 1), (2, 2)], [(2, 1), (2, 2), (2, 3)], [(3, 0), (3, 1), (3, 2)], [(3, 1), (3, 2), (3, 3)], [(0, 0), (1, 0), (2, 0)], [(1, 0), (2, 0), (3, 0)], [(0, 1), (1, 1), (2, 1)], [(1, 1), (2, 1), (3, 1)], [(0, 2), (1, 2), (2, 2)], [(1, 2), (2, 2), (3, 2)], [(0, 3), (1, 3), (2, 3)], [(1, 3), (2, 3), (3, 3)], [(0, 0), (1, 1), (2, 2)], [(0, 1), (1, 2), (2, 3)], [(0, 2), (1, 1), (2, 0)], [(0, 3), (1, 2), (2, 1)], [(1, 0), (2, 1), (3, 2)], [(1, 1), (2, 2), (3, 3)], [(1, 2), (2, 1), (3, 0)], [(1, 3), (2, 2), (3, 1)]]
	for pattern in patterns:
		line = [lines[y][x] for (y, x) in pattern]
		(x, d) = (2, 1)
		for ch in line:
			if ch == 'x':
				x -= 1
			if ch == '.':
				d -= 1
		if x == d == 0:
			print('YES')
			return
	print('NO')
solve()


def check1(data, arr):
	l = [data[i][k] for (i, k) in arr]
	return sum(map(lambda x: x == '.', l)) == 1 and sum(map(lambda x: x == 'x', l)) == 2

def check2(data, arr):
	return any([check1(data, a) for a in arr])

def generate1(i, j):
	return [(i + z, j) for z in range(3)]

def generate2(i, j):
	return [(i, j + z) for z in range(3)]

def generate3(i, j):
	return [(i + z, j + z) for z in range(3)]

def generate4(i, j):
	return [(i + z, j - z) for z in range(3)]

def check(data):
	l1 = [generate1(i, j) for i in range(2) for j in range(4)]
	l2 = [generate2(i, j) for i in range(4) for j in range(2)]
	l3 = [generate3(i, j) for i in range(2) for j in range(2)]
	l4 = [generate4(i, j) for i in range(2) for j in range(2, 4)]
	return check2(data, l1) or check2(data, l2) or check2(data, l3) or check2(data, l4)
data = [input() for i in range(4)]
if check(data):
	print('YES')
else:
	print('NO')


def tri(ar):
	d = {'.': 0, 'x': 0, 'o': 0}
	for (i, j) in ar:
		d[a[i][j]] += 1
	if d['.'] == 1 and d['x'] == 2:
		ans[0] = 'YES'
ans = ['NO']
a = [input() for i in range(4)]
for i in range(2):
	for j in range(2):
		tri([(i, j), (i + 1, j + 1), (i + 2, j + 2)])
	for j in range(2, 4):
		tri([(i, j), (i + 1, j - 1), (i + 2, j - 2)])
for i in range(4):
	for j in range(2):
		tri([(i, j), (i, j + 1), (i, j + 2)])
		tri([(j, i), (j + 1, i), (j + 2, i)])
print(ans[0])


def check(a):
	for i in range(4):
		for j in range(4):
			if a[i][j] == 'x':
				if i + 2 < 4 and a[i + 1][j] == 'x' and (a[i + 2][j] == 'x'):
					return True
				if j + 2 < 4 and a[i][j + 1] == 'x' and (a[i][j + 2] == 'x'):
					return True
				if i + 2 < 4 and j + 2 < 4 and (a[i + 1][j + 1] == 'x') and (a[i + 2][j + 2] == 'x'):
					return True
				if i + 2 < 4 and j - 2 >= 0 and (a[i + 1][j - 1] == 'x') and (a[i + 2][j - 2] == 'x'):
					return True
	return False
a = []
for i in range(4):
	a.append(list(input()))
for i in range(4):
	for j in range(4):
		if a[i][j] == '.':
			a[i][j] = 'x'
			if check(a) == True:
				print('YES')
				exit(0)
			a[i][j] = '.'
print('NO')


import sys, copy
A = []

def isAllX(a1, a2, b1, b2, c1, c2):
	global A
	if A[a1][a2] == 'x' and A[b1][b2] == 'x' and (A[c1][c2] == 'x'):
		return True
	return False
for i in range(4):
	s = input()
	B = []
	for i in s:
		B.append(i)
	A.append(B)
for i in range(4):
	for j in range(4):
		if A[i][j] == '.':
			C = copy.deepcopy(A)
			A[i][j] = 'x'
			if isAllX(0, 0, 0, 1, 0, 2) or isAllX(0, 1, 0, 2, 0, 3) or isAllX(1, 0, 1, 1, 1, 2) or isAllX(1, 1, 1, 2, 1, 3) or isAllX(2, 0, 2, 1, 2, 2) or isAllX(2, 1, 2, 2, 2, 3) or isAllX(3, 0, 3, 1, 3, 2) or isAllX(3, 1, 3, 2, 3, 3) or isAllX(0, 0, 1, 0, 2, 0) or isAllX(1, 0, 2, 0, 3, 0) or isAllX(0, 1, 1, 1, 2, 1) or isAllX(1, 1, 2, 1, 3, 1) or isAllX(0, 2, 1, 2, 2, 2) or isAllX(1, 2, 2, 2, 3, 2) or isAllX(0, 3, 1, 3, 2, 3) or isAllX(1, 3, 2, 3, 3, 3) or isAllX(0, 0, 1, 1, 2, 2) or isAllX(1, 1, 2, 2, 3, 3) or isAllX(1, 0, 2, 1, 3, 2) or isAllX(0, 1, 1, 2, 2, 3) or isAllX(0, 3, 1, 2, 2, 1) or isAllX(1, 2, 2, 1, 3, 0) or isAllX(0, 2, 1, 1, 2, 0) or isAllX(1, 3, 2, 2, 3, 1):
				print('YES')
				sys.exit()
			A = copy.deepcopy(C)
print('NO')


def p_po_vertik(mas, y, x):
	if mas[y + 1][x] == '.' and mas[y + 2][x] == 'x':
		return 1
	if mas[y - 1][x] == '.' and mas[y - 2][x] == 'x':
		return 1
	if mas[y][x + 1] == '.' and mas[y][x + 2] == 'x':
		return 1
	if mas[y][x - 1] == '.' and mas[y][x - 2] == 'x':
		return 1
	if mas[y + 1][x + 1] == '.' and mas[y + 2][x + 2] == 'x':
		return 1
	if mas[y - 1][x - 1] == '.' and mas[y - 2][x - 2] == 'x':
		return 1
	if mas[y - 1][x + 1] == '.' and mas[y - 2][x + 2] == 'x':
		return 1
	if mas[y + 1][x - 1] == '.' and mas[y + 2][x - 2] == 'x':
		return 1
	if mas[y + 1][x] == 'x' and mas[y + 2][x] == '.':
		return 1
	if mas[y - 1][x] == 'x' and mas[y - 2][x] == '.':
		return 1
	if mas[y][x + 1] == 'x' and mas[y][x + 2] == '.':
		return 1
	if mas[y][x - 1] == 'x' and mas[y][x - 2] == '.':
		return 1
	if mas[y + 1][x + 1] == 'x' and mas[y + 2][x + 2] == '.':
		return 1
	if mas[y - 1][x - 1] == 'x' and mas[y - 2][x - 2] == '.':
		return 1
	if mas[y - 1][x + 1] == 'x' and mas[y - 2][x + 2] == '.':
		return 1
	if mas[y + 1][x - 1] == 'x' and mas[y + 2][x - 2] == '.':
		return 1
flag = 0
a = [[0 for j in range(8)] for i in range(8)]
for i in range(4):
	stroka = input()
	for j in range(4):
		a[i + 2][j + 2] = stroka[j]
for i in range(8):
	if flag == 1:
		break
	for j in range(8):
		if a[i][j] == 'x':
			if p_po_vertik(a, i, j) == 1:
				print('YES')
				flag = 1
				break
if flag == 0:
	print('NO')


from sys import stdin, stdout
from os import path
rd = lambda : stdin.readline().strip()
wr = stdout.write
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
import time, math
mylist = []
for i in range(4):
	mylist.append(rd())
arr = set()
for i in range(4):
	arr.add(mylist[i][0:3])
	arr.add(mylist[i][1:])
	arr.add(mylist[0][i] + mylist[1][i] + mylist[2][i])
	arr.add(mylist[1][i] + mylist[2][i] + mylist[3][i])
for i in range(2):
	for j in range(2):
		arr.add(mylist[i][j] + mylist[i + 1][j + 1] + mylist[i + 2][j + 2])
		arr.add(mylist[3 - i][j] + mylist[2 - i][j + 1] + mylist[1 - i][j + 2])
print('YES' if {'.xx', 'x.x', 'xx.'} & arr else 'NO')