def METHOD_NAME(transaction: Transaction) -> tuple[str, str] | None:
    credited_types = {
        split.account.type for split in transaction.splits if split.amount > 0
    }
    debited_types = {
        split.account.type for split in transaction.splits if split.amount < 0
    }
    if len(credited_types) == len(debited_types) == 1:
        [cred_type] = credited_types
        [deb_type] = debited_types
        return cred_type, deb_type
    return None