field = [input() for _ in range(10)]


def check_ship(x, y, length, direction):
    if direction == 'horizontal':
        return all(field[x][y+i] == '#' for i in range(length))
    elif direction == 'vertical':
        return all(field[x+i][y] == '#' for i in range(length))
    return False


count_ships = 0
for i in range(10):
    for j in range(10):
        if field[i][j] == '#':
            count_ships += 1

if count_ships != 20:
    print("NO")
    exit()

ship_lengths = {'4': 1, '3': 2, '2': 3, '1': 4}
for length, count in ship_lengths.items():
    for _ in range(count):
        found = False
        for i in range(10):
            for j in range(10):
                if field[i][j] == '.':
                    if (j + int(length) <= 10 and all(field[i][j+k] == '.' for k in range(int(length)))):
                        for k in range(int(length)):
                            field[i] = field[i][:j+k] + '#' + field[i][j+k+1:]
                        found = True
                        break
                    elif (i + int(length) <= 10 and all(field[i+k][j] == '.' for k in range(int(length)))):
                        for k in range(int(length)):
                            field[i+k] = field[i+k][:j] + '#' + field[i+k][j+1:]
                        found = True
                        break
            if found:
                break
        if not found:
            print("NO")
            exit()


for i in range(10):
    for j in range(10):
        if field[i][j] == '#':
            if (i < 9 and field[i + 1][j] == '#') or (j < 9 and field[i][j + 1] == '#'):
                print("NO")
                exit()

print("YES")
