"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-08 03:39:39.701253
"""

```python
from typing import Callable, Optional


class FallbackExecutor:
    """
    A class for executing a main function with fallback options in case of errors.
    
    Parameters:
    - main_function: The primary function to execute, which must accept keyword arguments.
    - fallback_functions: A list of functions that serve as fallbacks. Each function
                          must have the same signature as `main_function`.
                          
    Methods:
    - run: Executes the main function and falls back to an alternative if an error occurs.
    """
    
    def __init__(self, main_function: Callable[..., object], fallback_functions: list[Callable[..., object]]):
        self.main_function = main_function
        self.fallback_functions = fallback_functions
    
    def run(self, **kwargs) -> Optional[object]:
        """
        Executes the main function with provided kwargs. If an error occurs,
        attempts to execute one of the fallback functions.
        
        Parameters:
        - **kwargs: Keyword arguments passed to both the main and fallback functions.
        
        Returns:
        The result of the successfully executed function or None if all fail.
        """
        for func in [self.main_function] + self.fallback_functions:
            try:
                return func(**kwargs)
            except Exception as e:
                print(f"Error occurred while executing {func.__name__}: {e}")
        return None


# Example usage
def main_function(x: int) -> str:
    """Squares the input and returns it."""
    return str(x ** 2)


def fallback1(x: int) -> str:
    """Returns a string with a different message if x is negative."""
    return "Negative number squared!"


def fallback2(x: int) -> str:
    """Returns a generic error message."""
    return "An unexpected error occurred!"


# Create an instance of FallbackExecutor
executor = FallbackExecutor(main_function, [fallback1, fallback2])

# Execute with a positive number (should work)
result_pos = executor.run(x=5)
print(result_pos)  # Expected output: '25'

# Execute with a negative number (should trigger the first fallback)
result_neg = executor.run(x=-3)
print(result_neg)  # Expected output: 'Negative number squared!'

# Execute with an invalid input (should trigger the second fallback, if any)
try:
    result_error = executor.run(x='a')
except Exception as e:
    print(f"Invalid input caught: {e}")
```