In the city of Ultima Thule job applicants are often offered an IQ test. 

The test is as follows: the person gets a piece of squared paper with a 4 × 4 square painted on it. Some of the square's cells are painted black and others are painted white. Your task is to repaint at most one cell the other color so that the picture has a 2 × 2 square, completely consisting of cells of the same color. If the initial picture already has such a square, the person should just say so and the test will be completed. 

Your task is to write a program that determines whether it is possible to pass the test. You cannot pass the test if either repainting any cell or no action doesn't result in a 2 × 2 square, consisting of cells of the same color.
Four lines contain four characters each: the *j*-th character of the *i*-th line equals "." if the cell in the *i*-th row and the *j*-th column of the square is painted white, and "#", if the cell is black.
import sys
lista=""
try:
    lista = sys.stdin.readlines()
except KeyboardInterrupt:
    pass

control = False
aprobo = "NO"
forma = ''

matriz=[]

for i in range(4):
    matriz.append(list(lista[i].strip('\n')))

print(matriz)

f= 0
while(f<4):    
    c= 0
        
    while( c < 4):
        l = False #inquierda
        r = False #derecha
        u = False #arriba
        d = False #abajo
        dru = False #diagonal derecha arriba 
        dlu = False #diagonal izq arriba
        drd = False #diagonal derecha abajo
        dld = False #diagonal izq abajo
        #Definimos formas        
        if(matriz[f][c] == '.'):
            forma = '#'
        else:
            forma = '.'
            
        if(f ==0 and c == 0):                        
            if(forma == matriz[f][c+1]):
                r = True
            else:
                r = False
            if(forma == matriz[f+1][c]):
                d = True
            else:
                d = False
            if(forma == matriz[f+1][c+1]):
                drd = True
            else:
                drd = False

            if(r and d and drd):
                aprobo ="YES"
                control = True
                break
            
        else:
            if(f == 0 and c == 3):
                if(forma == matriz[f][c-1]):
                    l = True
                else:
                    l = False
                if(forma == matriz[f+1][c]):
                    d = True
                else:
                    d = False
                if(forma == matriz[f+1][c-1]):
                    dld = True
                else:
                    dld = False

                if(l and d and dld):
                    aprobo ="YES"
                    control = True
                    break

            else:

                if(f ==3 and c == 0):
                    if(forma == matriz[f][c+1]):
                        r = True
                    else:
                        r = False
                    if(forma == matriz[f-1][c]):
                        u = True
                    else:
                        u = False
                    if(forma == matriz[f-1][c+1]):
                        dru = True
                    else:
                        dru = False

                    if(r and u and dru):
                        aprobo ="YES"
                        control = True
                        break
                else:
                    if(f ==3 and c == 3):
                        if(forma == matriz[f][c-1]):
                            l = True
                        else:
                            l = False
                        if(forma == matriz[f-1][c]):
                            u = True
                        else:
                            u = False
                        if(forma == matriz[f-1][c-1]):
                            dlu = True
                        else:
                            dlu = False
    
                        if(r and u and dru):
                            aprobo ="YES"
                            control = True
                            break
                    else:
                        if(f>0 and f< 3 and c>0 and c <3):
                            if(forma == matriz[f-1][c-1]):
                                dlu = True
                            else:
                                dlu = False
                            if(forma == matriz[f-1][c]):
                                u = True
                            else:
                                u = False
                            if(forma == matriz[f-1][c+1]):
                                dru = True
                            else:
                                dru = False

                            if(forma == matriz[f][c-1]):
                                l = True
                            else:
                                l = False
                            if(forma == matriz[f][c+1]):
                                r = True
                            else:
                                r = False

                            if(forma == matriz[f+1][c-1]):
                                dld = True
                            else:
                                dld = False
                            if(forma == matriz[f+1][c]):
                                d = True
                            else:
                                d = False
                            if(forma == matriz[f+1][c+1]):
                                drd = True
                            else:
                                drd = False

                                    
                            if((dlu and u and l) or (dru and u and r) or (dld and d and l) or (drd and d and r)):
                                aprobo ="YES"
                                control = True
                                break

                        else:
                            if(f>0 and c == 0):
                                if(forma == matriz[f-1][c]):
                                    u = True
                                else:
                                    u = False
                                if(forma == matriz[f-1][c+1]):
                                    dru = True
                                else:
                                    dru = False
                                if(forma == matriz[f][c+1]):
                                    r = True
                                else:
                                    r = False

    
                                if(forma == matriz[f+1][c]):
                                    d = True
                                else:
                                    d = False
                                    
                                if(forma == matriz[f+1][c+1]):
                                    drd = True
                                else:
                                    drd = False                                

                                    
                                if((u and dru and r) or (r and drd and d)):
                                    aprobo ="YES"
                                    control = True
                                    break

                            else:
                                if(f>0 and c == 3):
                                    if(forma == matriz[f-1][c]):
                                        u = True
                                    else:
                                        u = False
                                    if(forma == matriz[f-1][c-1]):
                                        dlu = True
                                    else:
                                        dlu = False
                                    if(forma == matriz[f][c-1]):
                                        l = True
                                    else:
                                        l = False

    
                                    if(forma == matriz[f+1][c-1]):
                                        dld = True
                                    else:
                                        dld = False
                                        
                                    if(forma == matriz[f+1][c]):
                                        d = True
                                    else:
                                        d = False                                
    
                                        
                                    if((u and dlu and l) or (l and dld and d)):
                                        aprobo ="YES"
                                        control = True
                                        break
                                
                        
        c = c+1        
        if(control):
            break
    f = f+1
    
print(aprobo)
		  		  			 	   			  	  			 	 	