def solve_c0f76784(x):
    """
    Required Transformations:
        - There are holes in the shape of a square.
        - The biggest square is filled with light blue.
        - The medium sized square is filled with orange.
        - The small square is filled with pink.

    How solve works:
        - In each row we search for hole boundaries, if none exist we skip to the next row.
        - If we find a hole boundary, we check to see if we already visited that hole.
        - If we haven't visited the hole before, we try to find the size of the hole.
        - Once we have the size and the top left corner of the hole, we fill it based on its size.
        - The biggest hole is filled with blue, medium with orange and smallest with pink.

    Grids solved:
        - All grids have been solved.
    """

    def get_size(x, row_start, column_start):
        """
        Helper function to get size of the hole.
        This will help us to assign the respective colour to the hole.

        Arguments:
            x: The input grid.
            row_start: Starting index for the current hole.
            column_start: Starting index for the current hole.
        """
        rows, columns = x.shape
        row_end, column_end = row_start, column_start
        size = 0
        # Iterate diagonally to see how far the hole boundaries can be pushed.
        while (
            (row_end < rows - 1)
            and (column_end < columns - 1)
            and x[row_end + 1, column_end + 1] == 0
        ):
            row_end += 1
            column_end += 1
            size += 1
        return (size, row_start, column_start)

    def visited(row_start, column_start, history):
        """
        Helper function to check if we already visited.
        This will help us to avoid searching within the same hole.

        Arguments:
            row_start: Starting index for the current row.
            column_start: Starting index for the current column.
            history: Current visited hole history.
        """
        for hist in history:
            if (
                row_start >= hist[1]
                and row_start <= hist[1] + (hist[0] + 2)
                and column_start >= hist[2]
                and column_start <= hist[2] + (hist[0] + 2)
            ):
                return True
        return False

    def fill(x, history):
        """
        Helper function to fill holes based on size.
        This will fill each identified hole based on its size.

        Arugments:
            x: The input grid.
            history: Locations and sizes of holes in the grid.
        """
        colours = {3: 8, 2: 7, 1: 6}  # Map colours based on size.
        for hist in history:
            size, row_start, column_start = hist
            for i in range(row_start, row_start + size):
                for j in range(column_start, column_start + size):
                    # The +1 is to compensate for the shift
                    # without this, the borders would be coloured.
                    x[i + 1][j + 1] = colours[size]
        return x

    x = x.copy()  # Prevents overwriting input array.

    rows, columns = x.shape
    history = []
    for i in range(rows):
        # If the row is zero, don't search.
        # This means that there are no hole boundaries.
        if x[i, :].sum() == 0:
            continue
        for j in range(1, columns - 1):
            if not visited(i, j, history):
                # Check if there is a change in value.
                if x[i][j] != x[i][j - 1]:
                    # If there is a change in value
                    # then check diagonally.
                    history.append(get_size(x, i, j))

    filled_x = fill(x, history)
    return filled_x