def find_blank_position(grid, blank):
    """Returns the number of row, from bottom, that contains the blank value."""
    for i, row in enumerate(grid[::-1]):
        if blank in row:
            return i + 1