from typing import List
import random


def _generate_statements(
    num_entities: int,
    num_relations: int,
    max_num_qualifier_pairs: int,
    num_statements: int,
) -> List[List[str]]:
    """Generate random statements."""
    entities = [f"e_{i}" for i in range(num_entities)]
    relations = [f"r_{i}" for i in range(num_relations)]
    return [
        [
            random.choice(entities),
            random.choice(relations),
            random.choice(entities),
        ] + sum(
            (
                [
                    random.choice(relations),
                    random.choice(entities),
                ]
                for _ in range(random.randrange(max_num_qualifier_pairs + 1))
            ),
            []
        )
        for _ in range(num_statements)
    ]