"""Create reasoning_engine
Generated by Phi-Octopus Eden
2025-11-08 18:02:00.117726
"""

```python
from typing import List, Optional

class KnowledgeBase:
    def __init__(self):
        self.facts = []

    def add_fact(self, fact: str) -> None:
        """
        Adds a new fact to the knowledge base.

        :param fact: A string representing a factual statement.
        """
        self.facts.append(fact)

    def retrieve_facts(self, topic: Optional[str] = None) -> List[str]:
        """
        Retrieves all facts or only those related to a specific topic.

        :param topic: An optional string representing the topic of interest.
        :return: A list of facts relevant to the given topic, or all facts if no topic is specified.
        """
        if topic:
            return [fact for fact in self.facts if topic.lower() in fact.lower()]
        else:
            return self.facts


def reasoning_engine(query: str, knowledge_base: KnowledgeBase) -> Optional[str]:
    """
    A simple reasoning engine that attempts to answer questions based on the given facts.

    :param query: A string representing the question.
    :param knowledge_base: An instance of the KnowledgeBase class containing relevant facts.
    :return: The answer to the question, or None if no relevant information is found.
    """
    topic = query.lower().strip('?').split()[0]
    
    # Retrieve all related facts
    facts = knowledge_base.retrieve_facts(topic)
    
    if not facts:
        return None
    
    for fact in facts:
        # Check if the question can be answered directly from the retrieved facts
        if any(word in topic for word in query.lower().split()):
            return fact

    return None


# Example usage
if __name__ == "__main__":
    kb = KnowledgeBase()
    kb.add_fact("The capital of France is Paris.")
    kb.add_fact("New York City is located in the United States.")
    
    question1 = "What is the capital of France?"
    answer1 = reasoning_engine(question1, kb)
    print(f"Answer to '{question1}': {answer1}")
    
    question2 = "Which country has New York City in it?"
    answer2 = reasoning_engine(question2, kb)
    print(f"Answer to '{question2}': {answer2}")
```