import random
from typing import List, Tuple

Record = Tuple[str, str]

NAME_POOL = (
    "User_Alex", "User_Bob", "User_Cat", "User_Dan", "User_Eva",
    "User_Fox", "User_Geo", "User_Hen", "User_Ira", "User_Leo"
)

def generate_records(n: int, repeat_names: bool = False, seed: int = 42) -> List[Record]:
    """Генерирует n кортежей (имя, телефон)."""
    rng = random.Random(seed)
    if repeat_names:
        return [
            (rng.choice(NAME_POOL), str(rng.randint(10**9, 10**10 - 1)))
            for _ in range(n)
        ]
    return [
        (f"User_{i:05d}", str(10**9 + i))
        for i in range(n)
    ]

def prepare_records_variants(records: List[Record], seed: int = 42) -> Tuple[List[Record], List[Record]]:
    """Возвращает пару: (перемешанный список, отсортированный по имени список)."""
    shuffled = records.copy()
    random.Random(seed).shuffle(shuffled)
    sorted_records = sorted(records, key=lambda rec: rec[0])
    return shuffled, sorted_records