def count_submatrices(M, K):
    m, n = len(M), len(M[0])
    count = 0

    for i in range(len(K) - m + 1):
        for j in range(len(K[0]) - n + 1):
            submatrix = [K[i + r][j:j + n] for r in range(m)]
            if submatrix == M:
                count += 1

    return count

def solve():
    m = ["." * 12]
    symb_count = 0
    for i in range(10):
        m.append("." + input() + ".")
        symb_count += m[-1].count("#")
    m.append("." * 12)

    if symb_count != 20:
        print("NO")
        return
    
    mT = list("".join(i) for i in zip(*m))

    corr_ships = {1: 4,
                2: 3,
                3: 2,
                4: 1}
    ships = {1: 0,
             2: 0,
             3: 0,
             4: 0}
    ship_mats = {1: ["...",
                     ".#.",
                     "..."],
                2: ["....",
                    ".##.",
                    "...."],
                3: [".....",
                    ".###.",
                    "....."],
                4: ["......",
                    ".####.",
                    "......"]}
    for i, j in ship_mats.items():
        if i == 1:
            ships[i] = count_submatrices(j, m)
        else:
            ships[i] = count_submatrices(j, m) + count_submatrices(j, mT)
    print("YES" if ships == corr_ships else "NO")
solve()