from typing import Union
from typing import List


def nested_list_equal(obj1: Union[int, List], obj2: Union[int, List]) -> bool:
    """Return whether two nested lists are equal, i.e., have the same value.

    Note: order matters.

    >>> nested_list_equal(17, [1, 2, 3])
    False
    >>> nested_list_equal([1, 2, [1, 2], 4], [1, 2, [1, 2], 4])
    True
    >>> nested_list_equal([1, 2, [1, 2], 4], [4, [2, 1], 2,  3])
    False
    >>> nested_list_equal([1, 2, 3], 17)
    False
    >>> nested_list_equal([1, 2, 3, 4], [1, 2, 3, 4, 5])
    False
    """
    # HINT: You'll need to modify the basic pattern to loop over indexes,
    # so that you can iterate through both obj1 and obj2 in parallel.

    # Check that obj1 is an integer.
    if isinstance(obj1, int) or isinstance(obj2, int):
        return obj1 == obj2
    # obj1 is a list
    else:
        # Check if both are list and same length
        if len(obj1) != len(obj2):
            return False
        # If obj2 is an integer
        for i in range(len(obj1)):
            if not nested_list_equal(obj1[i], obj2[i]):
                return False
    return True