from typing import List


def merge_related_queries(manager, select_related=List[str], prefetch_related=List[str]):
    """
    Merges `select_related` and `prefetch_related` fields of Queryset appropriately
    :param manager: class Queryset
    :param select_related: List of selected_related fields
    :param prefetch_related: List of prefetch_related fields
    :return: class Queryset
    """
    if select_related and prefetch_related:
        return manager.select_related(*select_related).prefetch_related(*prefetch_related)

    elif not select_related and prefetch_related:
        return manager.prefetch_related(*prefetch_related)

    elif select_related and not prefetch_related:
        return manager.select_related(*select_related)
    return manager